leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

commit f443d7a1613072b75d5afb6f905f57df564fce02
parent dbd844520d27f75c1d401462217499f2961467a8
Author: Dimitrije Dobrota <mail@dimitrijedobrota.com>
Date:   Fri, 12 May 2023 14:22:40 +0200

JavaScript Challenge: Day 8

Diffstat:
AProblems/2666.js | 13+++++++++++++
MREADME.md | 1+
2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/Problems/2666.js b/Problems/2666.js @@ -0,0 +1,13 @@ +/** + * @param {Function} fn + * @return {Function} + */ + +var once = function(fn) { + var called = false; + return function(...args){ + if(called) return undefined; + called = true; + return fn(...args); + } +}; diff --git a/README.md b/README.md @@ -544,4 +544,5 @@ for solving problems. | 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) | +| 2666 | Easy | [Allow One Function Call](Problems/2666.js) | | 2667 | Easy | [Create Hello World Function](Problems/2667.js) |