Uber SDE Off-Campus OA | HackerRank | Balanced Permutation Subarray
Uber · Question · Posted Jun 2026
Problem 1 - Balanced Permutation Subarray Problem Statement You are given a permutation array p of length N, containing all integers from 1 to N exactly once. For each integer k (1 ≤ k ≤ N), we define k to be balanced if the elements {1, 2, ..., k} appear together in a contiguous subarray of length exactly k. In other words, there must exist some index i such that the subarray: p[i], p[i+1], ..., p[i+k-1] contains exactly the elements ...
The full answer & interview discussion are available to premium members.
Log in Create a free account