HAPPAY Hiring Challenge | Online Assessment Question | On-Campus (2024)

Question · Posted Jun 2026

Find Target Indices After Sorting Array Problem Statement You are given an integer array nums and an integer target. Sort the array in non-decreasing order and return a list of all indices where the value equals target in the sorted array. Return the indices in ascending order. Example Input nums = [1,2,5,2,3] target = 2 Output [1,2] Explanation After sorting: [1,2,2,3,5] The target value 2 appears at indices 1 and 2. Constraints 1 <= nums.length <= 100 1 <= nums[i], ...

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

Log in Create a free account