Compare Rectangle Area and Perimeter
EasyP3Coding
Two rectangles have length and breadth (l1, b1) and (l2, b2). Return [areaLarger, perimeterLarger], where areaLarger is true if the first rectangle's area is strictly larger than the second's, and perimeterLarger is true if its perimeter is strictly larger.
Example 1
- Input
- l1 = 4, b1 = 3, l2 = 2, b2 = 5
- Output
- [true,false]
- Why
- Areas 12 and 10, perimeters 14 and 14: area is larger, perimeter is equal so not larger.
Example 2
- Input
- l1 = 2, b1 = 2, l2 = 2, b2 = 2
- Output
- [false,false]
- Why
- Everything is equal.
Example 3
- Input
- l1 = 10, b1 = 1, l2 = 3, b2 = 3
- Output
- [true,true]
Constraints
- 1 <= l1, b1, l2, b2 <= 10^4
Hints
Give it a real attempt first. Run shows which examples fail.
Saved automatically
Run checks the 3 visible tests, Submit all 8. ⌘Enter runs, ⌘⇧Enter submits.