注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
'''
You are given operations, an array containing the following two types of operations:
[0, a, b] - Create and save a rectangle of size a * b
[1, a, b] - Answer the question: "Could a box of size a * b fit inside of each of the earlier saved rectangles?". It is possible to rotate the rectangles by 90 degrees; ie: a rectangel of dimensions a * b can be rotated so that its dimensions are b * a.
your task is to return an array of booleans, representing the answers to the second type of operation, in the order they appear.
Note that the operations should proceed iteratively, so when operations[i] is executed, only the results of the previous operations 0, 1, ..., i-1 are avaible.
Example
For operations = [[1,1,1]], the output should be solution(operations) = [true]
There43],
[0,20,12],
[0,15,15],
[1,143,202],
[0,15,20]]
Expected return value
[false, true, true, false, false]
operations:
[[0,24,18],
[1,23,8],
[0,22,13],
[0,18,26],
[0,27,28],
[1,361,287],
[0,28,15],
[0,25,16],
[1,117,339],
[0,18,14],
[1,6,5],
[0,12,11],
[0,22,25],
[0,22,18],
[1,317,483]]
Expected return value
[true, false, false, true, false]
''' |