Available question text
Add a groupBy(fn) method to arrays that returns an object mapping each string key produced by fn(item) to an array of items that produce that key, preserving the original order of items within each group. The callback fn receives an element and returns a string key; keys may appear in any order.
Related questions
Continue with questions that share topics or the same question type.
- Count Largest Group
Coding
- Count Ways to Group Overlapping Ranges
Coding
- Find Latest Group of Size M
Coding
- Group Anagrams
Coding · Array · Hash Table · Sorting
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 2631. Group By
Interview date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source