daily pastebin goal
72%
SHARE
TWEET

Untitled

a guest Sep 13th, 2017 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function findSolution(target) {
  2.   function find(start, history) {
  3.     if (start == target)
  4.       return history;
  5.     else if (start > target)
  6.       return null;
  7.     else
  8.       return find(start + 5, "(" + history + " + 5)") ||
  9.              find(start * 3, "(" + history + " * 3)");
  10.   }
  11.   return find(1, "1");
  12. }
  13.  
  14. console.log(findSolution(8));
RAW Paste Data
Top