NeetCode #967LC-2631MediumJavaScript
← Back to All Problems#967 · #2631 · Group By(分组)
📌 Problem Statement & Constraints
Implement
Array.prototype.groupBy(fn): group the elements by the value returned by fn(element) and return a plain object whose keys are the (stringified) group results and whose values are arrays of the grouped elements.🔒
Sign In to Unlock Full Solutions for All 973 Problems
Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!