← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
Implement a simplified poker-like game called Camel Cards to determine which of two players has the stronger hand.
Each hand has exactly 4 cards and is represented as a string such as "2332" or "9998".
Card ranks are ordered from high to low as:
9, 8, 7, 6, 5, 4, 3, 2, 1
Each hand belongs to exactly one of these types, from strongest to weakest:"9999""2332""9998""5233""2345"
Implement:evaluate(hand1: string, hand2: string) -> string
Return:"HAND_1" if hand1 wins"HAND_2" if hand2 wins"TIE" if both hands are exactly tied
Comparison rules:Both hands are two pair. Compare from right to left: 2 == 2, then 3 < 4, so hand2 wins.
Both are high-card hands. From right to left the last three cards tie, then 2 > 1 at the first dealt card.