Skip to content

Conversation

@anjanaouseph
Copy link

No description provided.

@anjanaouseph anjanaouseph changed the title Binary Search - 2 Completed Binary Search-2 Dec 27, 2025
@super30admin
Copy link
Owner

  • Strengths:

    • The solution correctly identifies the need for two binary searches to find the first and last occurrences.
    • The code is well-structured and readable, with helpful comments.
    • The time and space complexity are optimal.
  • Areas for Improvement:

    • The second binary search should start from the first occurrence found (low = first_occurrence) to reduce the search space and improve efficiency.
    • The unnecessary check if result else [-1,-1] should be removed since result is always initialized.
    • Consider using more descriptive variable names (e.g., range or indices instead of result).

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