Kumar-laxmi / Algorithms

A Repository for algorithms in C, C++, Python and Java
Apache License 2.0
316 stars 365 forks source link

[SSOC'23] Find minimum in rotated sorted array #1243

Closed Nikita06211 closed 4 months ago

Nikita06211 commented 1 year ago

Describe the solution you'd like Suppose an array of length n sorted in ascending order is rotated between 1 and n times. the algorithm will return the minimum element of this sorted rotated array of unique elements. The solution will be in c++.

Additional context Example: Input: nums = [3,4,5,1,2] Output: 1 Explanation: The original array was [1,2,3,4,5] rotated 3 times

kindly assign me this issue under SSOC'23.

TusharGagal commented 1 year ago

@Kumar-laxmi please assign me this task under ssoc'23

himughanakash commented 1 year ago

@Kumar-laxmi please this issue to me so that i start working on this under ssoc'23 program.

chhavisharma30 commented 1 year ago

I can solve this issue. It can be solved by two approaches. We can either sort the array so that the first element will be minimum. Or we can linearly travel in the array and when we find an element which is smaller than its previous element, then that is the minimum element in the rotated sorted array. Kindly assign me this issue so that I can work on this.

shivangi2002 commented 1 year ago

@kum

Describe the solution you'd like Suppose an array of length n sorted in ascending order is rotated between 1 and n times. the algorithm will return the minimum element of this sorted rotated array of unique elements. The solution will be in c++.

Additional context Example: Input: nums = [3,4,5,1,2] Output: 1 Explanation: The original array was [1,2,3,4,5] rotated 3 times

kindly assign me this issue under SSOC'23.

@Kumar-laxmi kindly assign me this issue.

github-actions[bot] commented 4 months ago

Stale issue message