Skip to content

Adding the solutions#2478

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

Adding the solutions#2478
subbu4061 wants to merge 1 commit intosuper30admin:masterfrom
subbu4061:master

Conversation

@subbu4061
Copy link
Copy Markdown

No description provided.

@super30admin
Copy link
Copy Markdown
Owner

The student's solution for "Search in Rotated Sorted Array" is excellent. It correctly implements the binary search algorithm for a rotated sorted array, with appropriate checks to determine which half is sorted and whether the target is within that half. The time and space complexities are optimal. The code is clean and easy to understand.

However, note that the student has included solutions for other problems (SearchA2DMatrix and SearchInInfiniteSortedArray) in the same file. While these are correct for their respective problems, it's important to keep solutions separate for clarity. For the purpose of this evaluation, we are only considering the "Search in Rotated Sorted Array" solution.

One minor point: in the condition if(nums[low]<= nums[mid]), it's common to use <= to handle the case when low and mid are the same (which can happen when the array has only one element). This is correctly handled.

Overall, the student has demonstrated a good understanding of binary search and its application to rotated arrays.

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