Problem link — https://leetcode.com/problems/furthest-building-you-can-reach/
I am able to come up with the solution after some time but I still don't know and am not able to debug why my previous solution giving wrong answer for particular test case.Could anyone help me to figure it out?
code:
You can do this using binary search.
https://leetcode.com/submissions/detail/727789686/
Indentation might be a bit messed up, I wrote this on my phone.
phone programmers orz orz orz
exactly me on my way to specialist with a brain and a phone
Consider the case:
heights = [1, 5, 6, 7] bricks = 2 ladders = 0
Your code returns 2. But with only two bricks you cant even move a single building. So the correct answer would be 0.