leetcodeSolution to some Leetcode problems written in C++ |
git clone git://git.dimitrijedobrota.com/leetcode.git |
Log | Files | Refs | README | LICENSE | |
commit | 4fafc96a132fb3b9605f3078b119b91e2884b7fa |
parent | b06d7a42ad7246c9aaa58f15dc98b082d66ec8c1 |
author | Dimitrije Dobrota <mail@dimitrijedobrota.com> |
date | Thu, 11 May 2023 18:38:31 +0200 |
JavaScript Challenge: Day 7
Diffstat:A | Problems/2629.js | | | +++++++++++++++ |
M | README.md | | | + |
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/Problems/2629.js b/Problems/2629.js
@@ -0,0 +1,15 @@
/**
* @param {Function[]} functions
* @return {Function}
*/
var compose = function(functions) {
return (x) => {
if (functions.length === 0) return x;
for (const func of functions.reverse())
x = func(x);
return x;
}
}
diff --git a/README.md b/README.md
@@ -539,6 +539,7 @@ for solving problems.
| 2497 | Medium | [Maximum Star Sum of a Graph](Problems/2497.cpp) |
| 2620 | Easy | [Counter](Problems/2620.js) |
| 2626 | Easy | [Array Reduce Transformation](Problems/2626.js) |
| 2629 | Easy | [Function Composition](Problems/2629.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) |