Day_2
Intro.
Q6. Make Array Consecutive 2
Ratiorg got statues of different sizes as a present from CodeMaster for his birthday, each statue having an non-negative integer size. Since he likes to make things perfect, he wants to arrange them from smallest to largest so that each statue will be bigger than the previous one exactly by 1. He may need some additional statues to be able to accomplish that. Help him figure out the minimum number of additional statues needed.
1 | def makeArrayConsecutive2(statues): |
Q7. almostIncreasingSequence
Given a sequence of integers as an array, determine whether it is possible to obtain a strictly increasing sequence by removing no more than one element from the array.
Note: sequence a0
, a1
, …, an
is considered to be a strictly increasing if a0 < a1 < ... < an
. Sequence containing only one element is also considered to be strictly increasing.
1 | # 못 풀겠어서 솔루션을 가져왔음 pharfenmeister의 솔루션 |
못 푼 이유: 조건이 잘 그려지지 않음
고민한 시간: 1시간 고민