All problems
Crop Boxes
Problem
Shift boxes after cropping an image at (left, top).
Subtract left from x coordinates and top from y coordinates, rounding each value to 4 decimal places. Boxes fully outside the crop are kept as negative values.
Test cases
case 1
in: [[[0,0,2,2],[5,5,7,7]],1,2]
expected: [[-1,-2,1,0],[4,3,6,5]]
case 2
in: [[[1,2,3,4]],0,0]
expected: [[1,2,3,4]]
case 3
in: [[],1,1]
expected: []
Starter codePython
def crop_boxes(boxes, left, top):
# Your code here
pass3 test cases · run your code against them in the editor