-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAreEquallyStrong.java
27 lines (20 loc) · 1.13 KB
/
AreEquallyStrong.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*
Call two arms equally strong if the heaviest weights they each are able to lift are equal.
Call two people equally strong if their strongest arms are equally strong (the strongest arm can be both the right and the left), and so are their weakest arms.
Given your and your friend's arms' lifting capabilities find out if you two are equally strong.
Example
For yourLeft = 10, yourRight = 15, friendsLeft = 15 and friendsRight = 10, the output should be
areEquallyStrong(yourLeft, yourRight, friendsLeft, friendsRight) = true;
For yourLeft = 15, yourRight = 10, friendsLeft = 15 and friendsRight = 10, the output should be
areEquallyStrong(yourLeft, yourRight, friendsLeft, friendsRight) = true;
For yourLeft = 15, yourRight = 10, friendsLeft = 15 and friendsRight = 9, the output should be
areEquallyStrong(yourLeft, yourRight, friendsLeft, friendsRight) = false.
*/
boolean areEquallyStrong(int yourLeft, int yourRight, int friendsLeft, int friendsRight) {
if(yourLeft==friendsLeft&&yourRight==friendsRight)
return true;
else if(yourLeft==friendsRight&&yourRight==friendsLeft)
return true;
else
return false;
}