Skip to content

DSA

Algorithms, Data Structures, Competitive Coding, and problems from LeetCode with complete Solution Approach, Pseudocode, and Explanation.

Allow One Function Call - 2666

Allow One Function Call – 2666

🔗LC2666 🟢 Easy 🧩 Pattern – Function Transformations 📅 Day 10/30 Days of JavaScript Given a function fn, return a new function that is identical to the original function except that it ensures fn is called at most once. Example Solution

Function Composition - 2629

Function Composition – 2629

🔗LC2629 🟢 Easy 🧩 Pattern – Function Transformations 📅 Day 8/30 Days of JavaScript Given an array of functions [f1, f2, f3, …, fn], return a new function fn that is the function composition of the array of functions. The function composition of [f(x), g(x), h(x)] is fn(x) = f(g(h(x))). The function composition of an empty list of functions is the identity function f(x) = x. You… Read More »Function Composition – 2629

Apply Transform Over Each Element in Array - 2635

Apply Transform Over Each Element in Array – 2635

🔗LC2635 🟢 Easy 🧩 Pattern – Array Transformations 📅 Day 5/30 Days of JavaScript Given an integer array arr and a mapping function fn, return a new array with a transformation applied to each element. The returned array should be created such that returnedArray[i] = fn(arr[i], i). Please solve it without the built-in Array.map method.… Read More »Apply Transform Over Each Element in Array – 2635