C# Are Equally Strong
static bool AreEquallyStrong(int yourLeft, int yourRight, int friendsLeft, int friendsRight)
{
return Math.Max(yourRight, yourLeft) == Math.Max(friendsLeft, friendsRight)
&& Math.Min(yourLeft, yourRight) == Math.Min(friendsRight, friendsLeft);
}
This compares each person’s strongest and weakest arm. If both pairs match, the result is true.
Elixir Are Equally Strong
defmodule AreEquallyStrong do
def are_equally_strong(your_left, your_right, friends_left, friends_right) do
max(your_right, your_left) == max(friends_left, friends_right) and
min(your_left, your_right) == min(friends_right, friends_left)
end
end
This compares each person’s strongest and weakest arm. If both pairs match, the result is true.
Erlang Are Equally Strong
-module(are_equally_strong).
-export([are_equally_strong/4]).
are_equally_strong(YourLeft, YourRight, FriendsLeft, FriendsRight) ->
max(YourRight, YourLeft) =:= max(FriendsLeft, FriendsRight) andalso
min(YourLeft, YourRight) =:= min(FriendsRight, FriendsLeft).
This compares each person’s strongest and weakest arm. If both pairs match, the result is true.
Go Are Equally Strong
func areEquallyStrong(yourLeft, yourRight, friendsLeft, friendsRight int) bool {
return max(yourRight, yourLeft) == max(friendsLeft, friendsRight) &&
min(yourLeft, yourRight) == min(friendsRight, friendsLeft)
}
This compares each person’s strongest and weakest arm. If both pairs match, the result is true.
Haskell Are Equally Strong
areEquallyStrong :: Int -> Int -> Int -> Int -> Bool
areEquallyStrong yourLeft yourRight friendsLeft friendsRight =
max yourRight yourLeft == max friendsLeft friendsRight
&& min yourLeft yourRight == min friendsRight friendsLeft
This compares each person’s strongest and weakest arm. If both pairs match, the result is true.
Java Are Equally Strong
public class Solution {
public static boolean areEquallyStrong(int yourLeft, int yourRight, int friendsLeft, int friendsRight) {
return Math.max(yourLeft, yourRight) == Math.max(friendsLeft, friendsRight)
&& Math.min(yourLeft, yourRight) == Math.min(friendsLeft, friendsRight);
}
}
This compares each person’s strongest and weakest arm. If both pairs match, the result is true.
Lisp Are Equally Strong
(defun are-equally-strong (your-left your-right friends-left friends-right)
(and (= (max your-right your-left) (max friends-left friends-right))
(= (min your-left your-right) (min friends-right friends-left))))
This compares each person’s strongest and weakest arm. If both pairs match, the result is true.
PHP Are Equally Strong
function areEquallyStrong($yourLeft, $yourRight, $friendsLeft, $friendsRight)
{
return max($yourRight, $yourLeft) === max($friendsLeft, $friendsRight)
&& min($yourLeft, $yourRight) === min($friendsRight, $friendsLeft);
}
This compares each person’s strongest and weakest arm. If both pairs match, the result is true.
Python Are Equally Strong
def are_equally_strong(
your_left: int, your_right: int, friends_left: int, friends_right: int
) -> bool:
return max(your_right, your_left) == max(friends_left, friends_right) and min(
your_left, your_right
) == min(friends_right, friends_left)
This compares each person’s strongest and weakest arm. If both pairs match, the result is true.
Rust Are Equally Strong
fn are_equally_strong(your_left: i64, your_right: i64, friends_left: i64, friends_right: i64) -> bool {
your_right.max(your_left) == friends_left.max(friends_right)
&& your_left.min(your_right) == friends_right.min(friends_left)
}
This compares each person’s strongest and weakest arm. If both pairs match, the result is true.