Question bank › Binary Search
Dsa Binary Search Medium

Count Occurrences in Rotated Array

You are given a rotated sorted array and an integer. Your task is to count the number of occurrences of that integer in the array. If the array is [2, 5, 6, 0, 0, 1, 2] and the target is 0, the count is 2. Input Format: - The first line contains an integer n (1 ≤ n ≤ 1000), the number of elements in the array. - The second line contains n space-separated integers representing the array elements. - The third line contains the target integer. Output Format: - A single integer representing the count of occurrences of the target in the array. Example: Input: 7 2 5 6 0 0 1 2 0 Output: 2

Key concepts

binary_searcharraysearching

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 InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.