Samsung SDE Interview Quesiton 2022 October| Advanced Data Structures (Binary Indexed Trees) | off-campus
Samsung · Question · Posted Jun 2026
Question 1: Count Inversions in an Array Problem Statement Given an array of integers nums, return the total number of inversions in the array. Two elements nums[i] and nums[j] form an inversion if nums[i] > nums[j] and i < j. An O(N log N) Merge Sort approach is standard, but you must implement a solution using a Fenwick Tree (Binary Indexed Tree) to demonstrate advanced data structure knowledge. Constraints 1 <= nums.length <= 105 -104 <= nums[i] <= 104 Example ...
The full answer & interview discussion are available to premium members.
Log in Create a free account