Skip to content

LeetCode

Compact Object - 2705

Compact Object – 2705

🔗LC2705 🟡 Medium 🧩 Pattern – JSON, Arrays and Objects 📅 Day 27/30 Days of JavaScript Given an object or array obj, return a compact object. A compact object is the same as the original object, except with keys containing falsy values removed. This operation applies to the object and any nested… Read More »Compact Object – 2705

Flatten Deeply Nested Array – 2625

🔗LC2625 🟡 Medium 🧩 Pattern – JSON, Arrays and Objects 📅 Day 26/30 Days of JavaScript Given a multidimensional array arr and a depth n, return a flattened version of that array. A multidimensional array is a recursive data structure that contains integers or other multidimensional arrays. A flattened array is a version of that array with some or all of… Read More »Flatten Deeply Nested Array – 2625

Sort By - 2724

Sort By – 2724

🔗LC2724 🟢 Easy 🧩 Pattern – JSON, Arrays and JS Sort 📅 Day 24/30 Days of JavaScript Given an array arr and a function fn, return a sorted array sortedArr. You can assume fn only returns numbers and those numbers determine the sort order of sortedArr. sortedArr must be sorted in ascending order… Read More »Sort By – 2724

Group By - 2631

Group By – 2631

🔗LC2631 🟡 Medium 🧩 Pattern – JSON, Objects and Arrays 📅 Day 23/30 Days of JavaScript Write code that enhances all arrays such that you can call the array.groupBy(fn) method on any array and it will return a grouped version of the array. A grouped array is an object where each key is the output of… Read More »Group By – 2631