Guest User

Untitled

a guest
Feb 21st, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. Sure, there's a way to use reduce and do this all in one line. This v2 is 477 bytes as is.
  2.  
  3. test data:
  4. const sample_input = [[7,8,100,101,222,223],
  5. [ 2,3,88,89,90,103,177 ],
  6. [ 2,3,6,7,10,11 ],
  7. [ 1 ],
  8. [ 1,2 ]]
  9.  
  10. const sample_output = [ "4/5","5/6","3/6","1/1","1/2" ]
  11.  
  12. and test with:
  13. console.log(app(sample_input).toString() === sample_output.toString() ? "success" : "fail")
Add Comment
Please, Sign In to add comment