Task:
Your job here is to write a function (keepOrder in JS/CoffeeScript, keep_order in Ruby/Crystal/Python, keeporder in Julia), which takes a sorted array ary and a value val, and returns the l...
I just tried my first problem on Codewars and realised: This solution feels like cheating
I first did something with findfirst, which needed some bounds checks. Then I saw another answer and they used searchsortedfirst which is just it … Even the documentation reads like the problem description
I first did something with
findfirst
, which needed some bounds checks. Then I saw another answer and they usedsearchsortedfirst
which is just it … Even the documentation reads like the problem descriptionAh so the library is just made for problems like this. Who would have thought :)