###### tags: `Weekly Contest` # Weekly Contest 430 ## [3402. Minimum Operations to Make Columns Strictly Increasing](https://leetcode.com/problems/minimum-operations-to-make-columns-strictly-increasing/) (<font color=#00B8A3>Easy</font>) ### Solution 要使每一列嚴格遞增,我們需要確保每列中的元素從上到下依次增大。所以我們可以計算每列中需要修改的元素數量,使其符合嚴格遞增的要求。 #### 時間複雜度: $O(N^2)$ #### 空間複雜度: $O(N)$ 程式碼: ```c++= class Solution { public: int minimumOperations(vector<vector<int>>& grid) { vector<int> record(grid[0].size()); int result = 0; for (int i = 0; i < grid[0].size(); i++) { record[i] = grid[0][i]; } for (int i = 1; i < grid.size(); i++) { for (int j = 0; j < grid[i].size(); j++) { record[j] = max(record[j]+1, grid[i][j]); result += (record[j] - grid[i][j]); } } return result; } }; ``` ## [3403. Find the Lexicographically Largest String From the Box I](https://leetcode.com/problems/find-the-lexicographically-largest-string-from-the-box-i/) (<font color=#FFC011>Medium</font>) ### Solution #### 時間複雜度: #### 空間複雜度: 程式碼: ```c++= ``` ## [3404. Count Special Subsequences](https://leetcode.com/problems/count-special-subsequences/) (<font color=#FFC011>Medium</font>) ### Solution #### 時間複雜度: #### 空間複雜度: 程式碼: ```c++= ``` ## [3405. Count the Number of Arrays with K Matching Adjacent Elements](https://leetcode.com/problems/count-the-number-of-arrays-with-k-matching-adjacent-elements/) (<font color=#FF375F>Hard</font>) ### Solution #### 時間複雜度: #### 空間複雜度: 程式碼: ```c++= ```