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