We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Mathematics
- Geometry
- Rectangular Game
- Discussions
Rectangular Game
Rectangular Game
Sort by
recency
|
42 Discussions
|
Please Login in order to post a comment
The number of squares with the highest 'x' count may exceed the range of a 32 bit integer so use long variables instead.
def solve(steps): # Write your code here first = True for i in steps: if first: minrow = i[0] mincol = i[1] first = False else: if i[0] < minrow: minrow = i[0] if i[1] < mincol: mincol = i[1] return (minrow * mincol)
In Kotlin, I got an overflow error in some test cases. I needed to change the return type for Long to make it pass.
Java :