All problems
Flip Boxes Horizontally
Problem
Mirror boxes horizontally for an image of the given width.
Map [x1, y1, x2, y2] to [width - x2, y1, width - x1, y2] and round each value to 4 decimal places.
Test cases
case 1
in: [[[1,2,3,4],[0,0,10,10]],10]
expected: [[7,2,9,4],[0,0,10,10]]
case 2
in: [[[2,1,5,3]],6]
expected: [[1,1,4,3]]
case 3
in: [[],8]
expected: []
Starter codePython
def flip_boxes_h(boxes, width):
# Your code here
pass3 test cases · run your code against them in the editor