四月十三號(第二發(fā))

100. Same Tree:比較root的val和所有子樹

169. Majority Element: 投票法,不過這題還要具體去看一篇blog理解背后的含義

242. Valid Anagram: 就是一道hash題,所有的hash題都比較簡單

504. Base 7: 還是用基本的mod循環(huán)

409. Longest Palindrome: 這更是一道數(shù)學(xué)題

217. Contains Duplicate:可以用set或者用hash

13. Roman to Integer:這道題我一向怕,不過這題不太可能考,因?yàn)檎l知道羅馬字是個啥。。。

401. Binary Watch:這道題值得重新做一遍,backtracking的典型應(yīng)用

206. Reverse Linked List: 鏈表題目的基礎(chǔ)款

350. Intersection of Two Arrays II: 該sort就sort,該hash就hash

541. Reverse String II:沒啥意思,就是控制pointer然后reverse就好了

268. Missing Number: 用數(shù)學(xué)的方法要容易些

447. Number of Boomerangs: 用hashmap然后加一點(diǎn)排列組合的方法

543. Diameter of Binary Tree: 又是一題divide and conquer

108. Convert Sorted Array to Binary Search Tree: divide and conquer找中點(diǎn)

415. Add Strings: 沒什么算法,普通的engineer的問題

405. Convert a Number to Hexadecimal: 這題有點(diǎn)像7based那一題,不過這里用binary了,重刷一遍

121. Best Time to Buy and Sell Stock: 更新最小prefix就可以了

202. Happy Number: 又是一道數(shù)學(xué)題,一來對數(shù)學(xué)題無感,第二今天刷了兩頁,最后還是比較疲勞的,體會到了欲速不達(dá)

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容