Code
Loading editor...
Tap Analyze to see visualization
Click Analyze to visualize
See step-by-step execution, variables, and output
Variables
Run code to see variables
Output
Console output will appear here
Click Analyze to visualize
See step-by-step execution, variables, and output
Run code to see variables
Console output will appear here
Use the same rotated-search logic as LeetCode 33, but when left, mid, and right are equal, drop both boundaries by one because duplicates remove the sorted-half decision.
When all three values are equal, duplicates hide ordering information so we shrink the range. Otherwise one half is sortable and can decide if target is inside it.
Updated Feb 2026