### Non-Maximum Suppression
In object detection, we often have multiple bounding boxes that overlap. Non-maximum suppression (NMS) is a technique used to eliminate redundant bounding boxes and keep only the most accurate ones.
**Example:** Given a list of bounding boxes, we want to apply NMS to eliminate redundant boxes and return the top N boxes.
**Constraints:** The input boxes are sorted by confidence score in descending order.
### Solution
Write a function non_max_suppression that takes a list of bounding boxes and returns the top N boxes after applying NMS.
Test Cases
Test Case 1
Input:
[[(1, 1, 2, 2), 0.9], [(2, 2, 3, 3), 0.8], [(3, 3, 4, 4), 0.7]]Expected:
[[(1, 1, 2, 2), 0.9], [(2, 2, 3, 3), 0.8]]Test Case 2
Input:
[[(1, 1, 2, 2), 0.9], [(2, 2, 3, 3), 0.9], [(3, 3, 4, 4), 0.9]]Expected:
[[(1, 1, 2, 2), 0.9]]+ 3 hidden test cases