Skip to content

Conversation

@ashishbadhe97
Copy link

No description provided.

@super30admin
Copy link
Owner

  • The conditions in binarySearchFirst and binarySearchLast should be simplified to check if the current element is the first or last occurrence of the target. For example, in binarySearchFirst, you should check if mid == 0 or nums[mid - 1] != target to confirm it's the first occurrence. Similarly, in binarySearchLast, check if mid == nums.length - 1 or nums[mid + 1] != target to confirm it's the last occurrence.
  • The comments are helpful, but the logic for checking the first and last occurrences should be clarified to avoid confusion.
  • The return value of 5001 in findMin is not necessary and could be replaced with a more meaningful value or handled differently.

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.

3 participants