[Leet Code] Group the People Given the Group Size They Belong To

Leetcode: https://leetcode.com/problems/group-the-people-given-the-group-size-they-belong-to/

There are n people that are split into some unknown number of groups. Each person is labeled with a unique ID from 0 to n - 1.

You are given an integer array groupSizes, where groupSizes[i] is the size of the group that person i is in. For example, if groupSizes[1] = 3, then person 1 must be in a group of size 3.