-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Log:
Traceback (most recent call last): File "/code/tmp8dl2laag.py", line 60, in run_tests passed =
compare_results(result, test['expected']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/code/tmp8dl2laag.py", line 25, in compare_results expected = eval(expected);
return result[0]*result[1] == expected[0]*expected[1] and result[0] >= result[1]
and abs(result[0]-result[1]) <= abs(expected[0]-expected[1]) ~~~~~~^^^ IndexError: list index out of range
Reproduction:
Go to "Construct the Rectangle" and execute the following code:
class Solution:
def constructRectangle(self, area: int) -> List[int]:
min_diff = float("inf")
res = []
L_cache = set()
for W in range(1, area):
if W in L_cache:
break
if area % W != 0:
continue
L = area / W
L_cache.add(L)
if L - W < min_diff:
min_diff = L - W
res = [L, W]
return resReactions are currently unavailable
Metadata
Metadata
Labels
bugSomething isn't workingSomething isn't working