FastPrepPossible Bipartition
Problems/Possible Bipartition

Possible Bipartition

Coupang logoCoupang● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Coupang phone screen. The report names the well-known Possible Bipartition problem. Our version is about 100% the same as the reported question.

There are n people labeled from 1 to n. Each pair [a, b] in dislikes means that a and b must be placed in different groups.

Return true if all people can be split into two groups satisfying every pair, otherwise return false.

Function

possibleBipartition(n: int, dislikes: int[][]) → boolean

Examples

Example 1

n = 4dislikes = [[1,2],[1,3],[2,4]]return = true

One valid split is {1,4} and {2,3}.

Example 2

n = 3dislikes = [[1,2],[1,3],[2,3]]return = false

The three people form an odd cycle, so two groups are impossible.

Constraints

  • 1 <= n <= 2000.
  • 0 <= dislikes.length <= 10000.
  • 1 <= a, b <= n and a != b.
  • No dislike pair is duplicated.

More Coupang Phone Screen questions

  • LRU CachePHONE SCREEN · Seen Oct 2026
  • Dynamic Largest Anagram GroupPHONE SCREEN · Seen Sep 2026

Similar questions at other companies

  • Course ScheduleAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Evaluate DivisionApple · PHONE SCREENApple interview questions
  • Possible BipartitionByteDance · PHONE SCREENByteDance interview questions
  • Route Graph Reachability with a Broken LinkFigma · PHONE SCREENFigma interview questions
  • Count Friend CirclesOpenAI · PHONE SCREEN · ONSITE INTERVIEWOpenAI interview questions
  • Number of IslandsGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
  • Count Connected IslandsUber · PHONE SCREENUber interview questions
  • Course ScheduleNykaa · PHONE SCREENNykaa interview questions
  • Number of IslandsSpaceX · PHONE SCREENSpaceX interview questions
  • Pacific Atlantic Water FlowAnduril · PHONE SCREENAnduril interview questions
See Coupang hiring insights
Saved
class Solution {
    public boolean possibleBipartition(int n, int[][] dislikes) {
        // Write your code here.
    }
}
Checking account…