일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 선형대수
- cpp
- 주정부이민
- 컴퓨터과학과
- 프로그래머스
- mpnp
- MATLAB
- 캐나다 영주권
- 매트랩
- 개발자
- LAA
- Deep learning
- omscs
- 온라인석사
- 마니토바
- LV1
- leetcode
- 방송통신대학교
- C++
- 조지아텍
- Plotting
- 방통대
- zeros
- 머신러닝
- machine learning
- 코딩테스트
- 알고리즘
- EOI
- 기본
- 딥러닝
Archives
- Today
- Total
Krononberg
1827. Minimum Operations to Make the Array Increasing.cpp 본문
요구조건 정확히 안봐서 헤맴..
class Solution {
public:
int minOperations(vector<int>& nums) {
int res =0;
int len = nums.size();
for(int i =0; i<len-1;i++){
if(nums[i]>=nums[i+1]){
res += (nums[i] - nums[i+1] +1);
nums[i+1] += (nums[i] - nums[i+1] +1);
}a
}
return res;
}
};
'개발 로그 > 알고리즘' 카테고리의 다른 글
1630. Arithmetic Subarrays.cpp (0) | 2021.10.06 |
---|---|
1309. Decrypt String from Alphabet to Integer Mapping.cpp (0) | 2021.10.05 |
1863. Sum of All Subset XOR Totals.cpp (0) | 2021.10.04 |
1382. Balance a Binary Search Tree.cpp (0) | 2021.10.04 |
763. Partition Labels.cpp (0) | 2021.10.03 |