Ad
  • Custom User Avatar

    looks like u solved it

  • Custom User Avatar

    Firstly, please use the spoiler flag when you post code in the discourse, even if your solution is wrong.

    As for your code: are you supposed to return -1 if a is less than b or is there another condition that needs to be checked first? If I run your code with the following [a,b] values, it will always return -1, regardless of any margin:
    [1,2], [1,100], [5,6], [5,7], [5,8]. Can you see why?