# **2023 年「資訊科技產業專案設計」作業 1** 路易十四-KQC: Homework1 (漢)_1[] 路易十四-KQC: Homework1 (漢)_2[] 路易十四-KQC: Homework1 (英) [] **344. Reverse String** ``` word=input("please enter the word you want to reverse:") ##key in s=[] s.extend(word) def reverse(l,r): if l<=r: s[l],s[r]=s[r],s[l] reverse(l+1,r-1) reverse(0,len(s)-1) print(s) ``` **74. Search a 2D Matrix** ```class Solution: def searchMatrix(self, matrix: List[List[int]], target: int) -> bool: ROWS,COLS=len(matrix),len(matrix[0]) top,bot= 0,ROWS-1 while top<=bot: row=(top+bot)//2 if target>matrix[row][-1]: top=row+1 elif target<matrix[row][0]: bot=row-1 else: break if not (top<=bot): return False row=(top+bot)//2 l,r=0,COLS-1 while l<=r: m=(l+r)//2 if target>matrix[row][m]: l=m+1 elif target<matrix[row][m]: r=m-1 else: return True return False ``` **94. Binary Tree Inorder Traversal** ``` # Definition for a binary tree node. class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution: def inorderTraversal(self, root: Optional[TreeNode]) -> List[int]: res=[] def inorder(root): if not root: return inorder(root.left) res.append(root.val) inorder(root.right) inorder(root) return res ``` 參考資料 作業說明[https://hackmd.io/@sysprog/info2023-homework1] Leetcode.344[https://leetcode.com/problems/reverse-string/] Leetcode.74[https://leetcode.com/problems/search-a-2d-matrix/] Leetcode.94[https://leetcode.com/problems/binary-tree-inorder-traversal/] Coderpad[https://app.coderpad.io/RZTWCD7X] Software engineering interview[https://www.youtube.com/watch?v=BkszA-MvjXA] # **2023 年「資訊科技產業專案設計」作業 2** ### 對其他同學的批評 [肯尼-Ken](https://hackmd.io/QEx1twjrS4qSUO26bKi7XQ?both#%E7%AC%AC%E4%BA%8C%E6%AC%A1%E4%BD%9C%E6%A5%AD-%E4%BB%96%E8%A9%9504) [鋒美食-Tastii](https://hackmd.io/7_bOiFhNTVyUhQjOmiOG_Q?both#%E7%AC%AC%E4%BA%8C%E6%AC%A1%E4%BD%9C%E6%A5%AD-%E4%BB%96%E8%A9%95-04) [馬邦德-lalaman](https://hackmd.io/mi70vGblQjOoLoyZIxD72A?both#%E7%AC%AC%E4%BA%8C%E6%AC%A1%E4%BD%9C%E6%A5%AD---%E4%BB%96%E8%A9%95-03) 從中學到什麼 * 我特別挑了和我做同一題的同學,比較看看面對同一道題目,我們會如何扮演interviwer和interviwee,然後發現因為這題就是考簡單的中序遍歷,因此如果interviwer如果沒有包裝題目,interviwee就能非常直覺的反應到對應的解法,但如果像[00:10](https://youtu.be/dLgekAQhQF4?t=10)給一個實際案例,兩者之間的互動就能更多 * 大家(包含我自己)都不太熟悉REACTO裡的OPTIMIZE和後續的延伸問題,面試僅完成了解題目,舉例說明和完成編碼及簡單的TEST