Day 27 of 31-Day May LeetCode Challenge

Aanchal Patial
1 min readMay 27, 2020

--

Given a set of N people (numbered 1, 2, ..., N), we would like to split everyone into two groups of any size.

Each person may dislike some other people, and they should not go into the same group.

Formally, if dislikes[i] = [a, b], it means it is not allowed to put the people numbered a and b into the same group.

Return true if and only if it is possible to split everyone into two groups in this way.

--

--

Aanchal Patial

We never really grow up, we only learn how to act in public