Solved LeetCode program · 681 of 1,000
#0914 · X of a Kind in a Deck of Cards
Original English source
The deck is a list of 1, 2, 3, 4, 4, 3, 2, and 1. The counts is a list of 5 zeros.
For each card in deck.
Increase item card of counts by 1.
Keep a shared answer of 0.
To gather from left (a whole number) with right (a whole number). If right is 0, set answer to left, return. Gather from right with left modulo right.
For every rank from 0 to 4.
If item rank of counts is more than 0.
The amount is item rank of counts. If answer is 0, set answer to amount. If answer is more than 0, Gather from answer with amount.
If answer is at least 2, show true, otherwise show false.
Expected stdout
true