Question bank › Binary Search
Dsa Binary Search Easy

Closest Element in Rotated Array

Given a rotated array of unique integers and a target integer, write a program to find the closest element to the target in the array. The input will consist of a single line of space-separated integers representing the rotated array and a second line with the target integer. Output the closest element to the target. Example: Input: 4 5 6 7 0 1 2 3 Output: 2

Key concepts

binary_searchrotated_array

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of Praxari's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.