Longest run
11 2 2 5 4 3 3 8 7 11 15 Find the longest run. If you make the wildcards a 6 and 9, you can make the run (2,3,4,5,[6],7,8,[9]), which has length 8. you cannot make a longer run. My idea is sort the list in ascending order and then put the wild cards in between the cards. But I stucked on how to put them between the cards. Statement You have N cards in your hand. N−K cards have integers on them. The remaining K cards are wild cards that can each represent a card of any integer you choose. A run of length m is a sequence of m cards with the integers (a,a+1,a+2,…,a+m−1) for some integer a. For example, the sequences (7,8,9) , (1,2,3,4,5), and (6) are runs, but (2,3,5,6), (1,6), and (4,3,2,1) are not runs. What is the longest run you can make with these cards? You may rearrange the cards in your hand however you like to form this run. The input format and output format is in the chat section