← Back
00:00

Valid Card Set

Verily interview questions · Easy · Coding round · 7 tests

You are given a list of cards. Each card is encoded as a string whose numeric prefix is the rank and whose final character is the color: R, B, G, or Y. For example, "10R" means rank 10, red.

Write a function that returns true if the given cards form a valid card set, otherwise return false.

Function signature

isValidCardSet(cards: string[]): boolean

A set is valid if it contains at least 3 cards and matches exactly one of these patterns

Idle