[LeetCode] Minimum Consecutive Cards to Pick Up

1 · · May 1, 2022, 3:26 a.m.
2260. Minimum Consecutive Cards to Pick Up You are given an integer array cards where cards[i] represents the value of the ith card. A pair of cards are matching if the cards have the same value. Return the minimum number of consecutive cards you have to pick up to have a pair of matching cards among the picked cards. If it is impossible to have matching cards, return -1. ...