Graph M-Coloring
Updated
Problem statement
An undirected graph has vertices 0 through n - 1 and edges in edges.
Return whether you can assign at most m colors so that the endpoints of every edge have different colors. You may leave colors unused. A self-loop makes a proper coloring impossible.
Function
canColor(n: int, edges: int[][], m: int) → booleanExamples
Example 1
n = 3edges = [[0,1],[1,2],[2,0]]m = 3return = trueUse colors 1, 2 and 3 for vertices 0, 1 and 2. Every edge joins different colors.
Example 2
n = 3edges = [[0,1],[1,2],[2,0]]m = 2return = falseAfter vertices 0 and 1 receive different colors, vertex 2 is adjacent to both and needs a third color.
Constraints
- 1 <= n <= 12
- 1 <= m <= 12
- 0 <= edges.length <= 144
- Every edge has exactly 2 endpoints.
- 0 <= edges[i][j] <= 11
- Every endpoint is less than n. Repeated undirected edges are allowed.
Source note: Screenshots of public Reddit comments describing the reported Adobe OA task and any included author clarification. The practice version adds the details stated in the source note.
More Adobe Online Assessment questions
- Rotate an Array In PlaceOA · PHONE SCREEN · Seen Aug 2026
- Top-Funded Villages and ProjectsOA · Seen Aug 2026
- Count Parent Nodes With a Target SumOA · Seen Aug 2026
- Largest Binary Number by ConcatenationOA · Seen Aug 2026
- Count Events by CategoryOA · Seen Aug 2026
- Hall of Shifting TilesOA · Seen Aug 2026
- K-th Ancestor Subtree Preorder QueryOA · Seen Aug 2026
- Maze ReachabilityOA · Seen Aug 2026
- Minimum Numeric Code TransformationOA · Seen Aug 2026
- Number-Character Bijective MappingOA · Seen Aug 2026
Similar questions at other companies
- Longest Anchored Song ChainIntuit · OAIntuit interview questions
- Most-Read Page Across Every Valid StorylineDuolingo · OA · PHONE SCREENDuolingo interview questions
- Park Train Cars by PreferenceMercor · ONSITE INTERVIEWMercor interview questions
- Count Prefix Paths in a Character GraphGoogle · PHONE SCREENGoogle interview questions
- All Paths From Source to TargetBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
- Synonymous SentencesRippling · PHONE SCREENRippling interview questions
- Attraction Route Without Reusing TrailsWhatNot · PHONE SCREENWhatNot interview questions
- Enumerate Directed Paths and CyclesByteDance · PHONE SCREENByteDance interview questions
- Word Ladder II: All Shortest TransformationsPeopleStrong · ONSITE INTERVIEWPeopleStrong interview questions
- Three-Color an Undirected GraphSnowflake · PHONE SCREENSnowflake interview questions
Adobe interview experiences
- Adobe Web, QA, DevOps, ML Roles: 13 Experiences (Part 3 of 3)
- Adobe SWE Interviews, Level Unknown: 25 Experiences (Part 2 of 3)
- Adobe Interviews, Level Unknown: 38 Experiences (Part 1 of 3)
- Adobe New Grad MTS Interview Questions: 7 Experiences
- Adobe ML/Research Intern Interviews: 12 Experiences (Part 4 of 4)
- Adobe Product Intern Interviews: 15 Experiences (Part 3 of 4)