Compute value of card guessing game | Gts Interview Question