Skip to content

completed binary-search1 #2322

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JoshnaRavi04
Copy link

No description provided.

@super30admin
Copy link
Owner

  • For the rotated sorted array problem, the logic for adjusting low and high is incorrect. The conditions should check if the left or right half is sorted and then determine if the target lies within that sorted half. The current implementation does not correctly handle these cases, leading to incorrect search results.
  • The 2D matrix solution is well-implemented and correctly solves the problem. The use of integer division and modulus to map the 1D index to 2D coordinates is a good approach.
  • Consider adding more comments to explain the logic, especially for the rotated sorted array problem, to make it clearer why certain conditions are used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants