MAKEMYTRIP SDE-1 OA (2024) | Efficient Lookup in a Cyclically Shifted Ordered Dataset Using Binary Search

makemytrip · Question · Posted Jun 2026

Q1. Circularly Shifted Dataset Search Problem Statement A travel analytics platform stores destination identifiers in sorted order. Due to periodic data reorganization, the sorted sequence may be shifted at an unknown position while still preserving the relative order within each segment. Given: An integer array representing the reordered dataset. A target identifier. Return the index of the target if it exists; otherwise return -1. Your solution must run in O(log N) time. Example 1 Input dataset = [4,5,6,7,0,1,2] target = ...

The full answer & interview discussion are available to premium members.

Log in Create a free account