Pergunta de entrevista da empresa Amazon

Reverse a given linked list

Resposta da entrevista

Sigiloso

12 de fev. de 2021

As we all know that poker cards have four suites: Spades, Hearts, Clubs and Diamonds with figures from 1 to 13. Now you are given a set of poker cards, you can pick any one card as the first card. And except for the first card, you can only pick the card that has the same suit or figure with the previous one. Return the max number of cards you can. For example: [(H, 3), (H, 4), (S, 4), (D, 5), (D, 1)], it returns 3 as follows: (H,3)-->(H,4)-->(S,4)