Leetcode 1282. Group the People Given the Group Size They Belong To

Input: groupSizes = [3,3,3,3,3,1,3]
Output: [[5],[0,1,2],[3,4,6]]
Explanation:
The first group is [5]. The size is 1, and groupSizes[5] = 1.
The second group is [0,1,2]. The size is 3, and groupSizes[0] = groupSizes[1] = groupSizes[2] = 3.
The third group is [3,4,6]. The size is 3, and groupSizes[3] = groupSizes[4] = groupSizes[6] = 3.
Other possible solutions are [[2,1,6],[5],[0,4,3]] and [[5],[0,6,2],[4,3,1]].
Input: groupSizes = [2,1,3,3,3,2]
Output: [[1],[0,5],[2,3,4]]

--

--

--

CS new grad, 6 years experience related to supply chain management. Located in Bay area

Love podcasts or audiobooks? Learn on the go with our new app.

Official Announcement

The Logistics Battle: Walled Gardens vs Open Source Networks

How is it to be a Junior Software Developer for a Latina in Germany? .

Some system ideas to recap

Migrating Java microservices apps from Spring Boot to MicroProfile

What if I don’t blow

Agile Methedology: Revolutionizing Project Management

Resultado de imagen de agile methodology

Basic automated security testing of web application

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Gary Chiang

Gary Chiang

CS new grad, 6 years experience related to supply chain management. Located in Bay area

More from Medium

Count Binary Substrings

Leetcode 525. Contiguous Array

Find First And Last Position of Element in Sorted Array

LeetCode 843. Guess the Word