leetcodeSolution to some Leetcode problems written in C++ |
git clone git://git.dimitrijedobrota.com/leetcode.git |
Log | Files | Refs | README | LICENSE | |
commit | 5cba8c27830fb8d44ab396f67f4bf325304d7bd7 |
parent | a3aa09bd62446af77349b1c7c9bfe3c403267535 |
author | Dimitrije Dobrota <mail@dimitrijedobrota.com> |
date | Sun, 14 May 2023 18:50:11 +0200 |
JavaScript Challenge: Day 10
Diffstat:A | Problems/2632.js | | | ++++++++++++ |
M | README.md | | | + |
2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/Problems/2632.js b/Problems/2632.js
@@ -0,0 +1,12 @@
/**
* @param {Function} fn
* @return {Function}
*/
var curry = function(fn) {
return function curried(...args) {
if(args.length >= fn.length)
return fn(...args);
return (...nextArgs) => curried(...args, ...nextArgs);
};
};
diff --git a/README.md b/README.md
@@ -543,6 +543,7 @@ for solving problems.
| 2623 | Medium | [Memoize](Problems/2623.js) |
| 2626 | Easy | [Array Reduce Transformation](Problems/2626.js) |
| 2629 | Easy | [Function Composition](Problems/2629.js) |
| 2632 | Medium | [Curry](Problems/2632.js) |
| 2634 | Easy | [Filter Elements from Array](Problems/2634.js) |
| 2635 | Easy | [Apply Transform Over Each Element in Array](Problems/2635.js) |
| 2665 | Easy | [Counter II](Problems/2665.js) |