Square SDE Interview Question 2022 April | Binary Indexed Trees | On-campus
Question · Posted Jun 2026
Question 1: Count of Smaller Numbers After Self Problem Statement Given an integer array nums, return an integer array counts where counts[i] is the absolute number of smaller elements strictly to the right of nums[i]. This is a legendary array inversion problem that requires you to break the O(N^2) time limit. Constraints 1 <= nums.length <= 105 -104 <= nums[i] <= 104 Examples Example 1: Input: nums = [5,2,6,1] Output: [2,1,1,0] Explanation 1: To the right of 5, there are ...
The full answer & interview discussion are available to premium members.
Log in Create a free account