Skip to content

Done Binary-Search-2 #2182

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

sreeharsha4030
Copy link

No description provided.

@super30admin
Copy link
Owner

  • Strengths:

    • The binary search logic is correctly implemented for both first and last occurrences.
    • The code is clean, modular, and well-commented.
    • The time and space complexity are optimal.
  • Areas for Improvement:

    • Fix the initial condition to correctly handle null or empty arrays. The current condition if(nums == null && nums.length == 0) will not catch cases where the array is null or empty independently. It should be if(nums == null || nums.length == 0).
    • Consider adding a brief comment explaining the overall approach at the top of the class for better clarity.

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