leetcode

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

2629.js (246B)


      1 /**
      2  * @param {Function[]} functions
      3  * @return {Function}
      4  */
      5  
      6 var compose = function(functions) {
      7   return (x) => {
      8     if (functions.length === 0) return x;
      9 
     10     for (const func of functions.reverse())
     11       x = func(x);
     12 
     13     return x;
     14   }
     15 }