search in rotated sorted array java solution bug.
Closed this issue · 1 comments
phonowiz commented
The second solution in https://github.com/AlgoMaster-io/leetcode-solutions/blob/main/java/search-in-rotated-sorted-array.md does not always work. The first section of the code which selects the pivot ends up picking the wrong index. For example, try this input: {5,1,3} with target of 1.
ashishps1 commented
I tested it by submitting on LeetCode and it seems to work fine. Closing this issue.