Skyline Inversions Problem
Skyline Inversions Problem — ExecCode Hard DSA Practice
Solve the Skyline Inversions problem on ExecCode. Free online hard DSA practice in Searching & Sorting. Write and run code in Java, C++, Python — no signup required to run.
Problem description
Each building is a point (x, y). A pair is an inversion if one is strictly left of the other but strictly taller (smaller x, larger y, or the swap of that). Counting those pairs is 2D inversions: sort x and Fenwick on y, or CDQ divide-and-conquer. Count unordered pairs that form such an inversion. Equal x or equal y do not invert. You are given: points — [x, y] buildings Return inversion pair count. The pair is unordered: (A,B) is counted once.
Examples
Input {'points': [[1, 3], [2, 1], [3, 2]]}; Output 2. Input {'points': [[0, 0], [1, 1]]}; Output 0. Input {'points': [[5, 5]]}; Output 0
Constraints
Points may share a coordinate n = 0 → 0
Practice Skyline Inversions free on ExecCode. Browse DSA problems, topic map, and placement guides.