Programming Note
Resources
- Algorithms and Data Structures
online course: https://www.youtube.com/channel/UCirCLaGiw_zT6vJNI_At6ag
online course's text book: https://algs4.cs.princeton.edu/home/
解題SOP
1.確認題目
2.手解問題, 從中觀察
3.想方法
4.確認可行性 by example
5.複雜度分析及優化 (找redundant)
6.重複4.5.6直到考官滿意
7.寫code前最後的驗證
8.寫high level code
initial: new dblNode
put; check if exist
exist:
not exist:
get: get node from hashtable
exist;
not exist
9.完成coding
Mock Note
請先想好完整的algorithm ==> 不依賴 submit 開始
給alphabet ==> 不代表string 只包含alphabet
code 想完就應該要pass了
- 不可以用 map.put(s, map.get(s).add(i))
- 注意你 max min 的initial value
- map set get之前,要先預想有可能會是null的狀態
在使用另個方法前必須先自己分析time complexity和space complexity確定可以再優化,再提出另外個方法, 提出方法後必須解釋用了此data structure / algorithm的trade off
不要馬上去歸納方法, 要先列出所有的可能性, 展開tree, 再歸納
high level code 是主要列出你想要達到什麼目的, 接下來才是告訴interviewer你要怎麼去達到