Mr. Square is going on holiday. He wants to bring 2 of his favorite squares with him, so he put them in his rectangle suitcase.
Write a function that, given the size of the squares and the suitcase, return whether the squares can fit inside the suitcase.
fit_in(a,b,m,n)
a,b are the sizes of the squares
m,n are the sizes of the suitcase
Example
fit_in(1,2,3,2) should return True
fit_in(1,2,2,1) should return False
fit_in(3,2,3,2) should return False
fit_in(1,2,1,2) should return False
This challenge comes from SADragonMaker on CodeWars. Thank you to CodeWars, who has licensed redistribution of this challenge under the 2-Clause BSD License!
Want to propose a challenge idea for a future post? Email yo+challenge@dev.to with your suggestions!
Top comments (7)
The long side is the obvious case, but what if
=> FitIn(1,2,3,1)?
in C#
I know, it's a bit verbose, but very self explanatory. A short version will look like this:
In JavaScript.
Assert.IsFalse(fit_in(1,2,3,1)
In F#.
JS
Thanks for pointing that out, edited the solution.