Tap here to switch tabs
Problem
Submissions

Problem: Possible Bipartition

Try to solve the Possible Bipartition problem.

Statement

There are n people labeled from 11 to n. You are given an array dislikes where each dislikes[i] =[= [ a_i, b_i ]] indicates that person a_i and person b_i dislike each other.

Return true if it is possible to split everyone into 22 groups such that no two people in the same group dislike each other, or false otherwise.

Constraints:

  • 1≤1 \leq n ≤2000\leq 2000

  • 0≤0 \leq dislikes.length ≤104\leq 10^4

  • dislikes[i].length =2= 2

  • 1≤1 \leq a_i << b_i ≤\leq n

  • All the pairs of dislikes are unique.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Possible Bipartition

Try to solve the Possible Bipartition problem.

Statement

There are n people labeled from 11 to n. You are given an array dislikes where each dislikes[i] =[= [ a_i, b_i ]] indicates that person a_i and person b_i dislike each other.

Return true if it is possible to split everyone into 22 groups such that no two people in the same group dislike each other, or false otherwise.

Constraints:

  • 1≤1 \leq n ≤2000\leq 2000

  • 0≤0 \leq dislikes.length ≤104\leq 10^4

  • dislikes[i].length =2= 2

  • 1≤1 \leq a_i << b_i ≤\leq n

  • All the pairs of dislikes are unique.