c# 算法及數(shù)據(jù)結(jié)構(gòu)每日練習(xí)記錄_4
1.
https://leetcode.cn/problems/reverse-string/?envType=study-plan&id=suan-fa-ru-men&plan=algorithms&plan_progress=b48xitv
編寫一個(gè)函數(shù),其作用是將輸入的字符串反轉(zhuǎn)過來。輸入字符串以字符數(shù)組 s
的形式給出。
修改輸入數(shù)組、使用 O(1) 的額外空間解決這一問題
2.
https://leetcode.cn/problems/reverse-words-in-a-string-iii/description/?envType=study-plan&id=suan-fa-ru-men&plan=algorithms&plan_progress=b48xitv&orderBy=most_votes
s
1.
https://leetcode.cn/problems/reshape-the-matrix/description/?envType=study-plan&id=shu-ju-jie-gou-ru-men&plan=data-structures&plan_progress=b4tf6qe&orderBy=most_votes&languageTags=csharp
在 MATLAB 中,有一個(gè)非常有用的函數(shù) reshape
,它可以將一個(gè) m x n
矩陣重塑為另一個(gè)大小不同(r x c
給你一個(gè)由二維數(shù)組 mat
表示的 m x n
矩陣,以及兩個(gè)正整數(shù) r
和 c
,分別表示想要的重構(gòu)的矩陣的行數(shù)和列數(shù)。
重構(gòu)后的矩陣需要將原始矩陣的所有元素以相同的 行遍歷順序 填充。
如果具有給定參數(shù)的 reshape
操作是可行且合理的,則輸出新的重塑矩陣;否則,輸出原始矩陣
2.
https://leetcode.cn/problems/pascals-triangle/submissions/400723861/?envType=study-plan&id=shu-ju-jie-gou-ru-men&plan=data-structures&plan_progress=b4tf6qe&orderBy=most_votes
給定一個(gè)非負(fù)整數(shù) numRows
,生成「楊輝三角」的前 行。
在「楊輝三角」中,每個(gè)數(shù)是它左上方和右上方的數(shù)的和