Skip to content

Complete Binary-Search-2#2315

Open
PrakarshKamal wants to merge 1 commit intosuper30admin:masterfrom
PrakarshKamal:master
Open

Complete Binary-Search-2#2315
PrakarshKamal wants to merge 1 commit intosuper30admin:masterfrom
PrakarshKamal:master

Conversation

@PrakarshKamal
Copy link

No description provided.

@super30admin
Copy link
Owner

Your solution for the "First and Last Position" problem is excellent. It correctly implements two binary searches to find the first and last occurrence of the target. The code is efficient and meets the O(log n) requirement. Well done!

However, note that you have included solutions for other problems in the same submission. For future assignments, make sure to submit only the solution for the problem being evaluated. This helps in avoiding confusion and ensures that the evaluator focuses on the correct code.

One very minor suggestion: in the getFirst and getLast methods, you are passing the entire array and target each time. Since these are the same for both calls, you could consider making them class fields or simply not passing them (if you were to write in a class context where they are accessible). But the current approach is perfectly acceptable.

Keep up the good work!

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