Check if Array Is Sorted and Rotated | Leetcode 1752 | FAANG | Check with Circular Wrap

Опубликовано: 09 Сентябрь 2026
на канале: Pragya Gupta
57
8

In this video, we will solve Check if Array Is Sorted and Rotated (Leetcode 1752) step by step.

📌 Approaches:
1. Brute force: Try every possible rotation as the starting point and check whether the next n-1 elements are in non-decreasing order. If any rotation is sorted, return true.
2. Optimal: Count the number of positions where the sorted order breaks (nums[i-1] greater than nums[i]). A sorted-and-rotated array can have at most one such violation, including the circular check between the last and first element.


Problem: Check if Array Is Sorted and Rotated
My solutions on Github (C++ & JAVA) : https://github.com/pragya9460/Leetcod...
Leetcode Link: https://leetcode.com/problems/check-i...

Lets code with pragya

1752. Check if Array Is Sorted and Rotated

Leetcode today

May Leetcode Challenge Playlist:    • Rotate Function | Leetcode 396 | Super Sim...  
My leetcode playlist:    • Two Furthest Houses With Different Colors ...  

Related problems:
1. Find Minimum in Rotated Sorted Array:    • Find Minimum in Rotated Sorted Array | FAA...  
2. Find Minimum in Rotated Sorted Array II:    • Find Minimum in Rotated Sorted Array II | ...  

#leetcode #dsa #leetcodetoday #bruteforce #codewithpragya #optimalsolution #optimization #beginners #beginner #leetcodepotd #leetcodechallenge #brute #linkedlist #list #dsa #array #binarysearch #searching #twopointer #beginners #bruteforce #rotation #sorted