2023年 資訊科技產業專案設計 作業1
contributer: 哈囉-Hi
video: 1, 2, 3
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
imterviewer
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
interviewee
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
: Hi , I'm Jo. Here's a question for you . Given an integer array num consisting of n elements , and an integer k. Find a contiguous subarray whose length is equal to k that has the maximum average value and return this value . Any answer with a calculation error less than 10-5 will be accepted
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
: You means that I got an array and an integer , then I need to do the calculation to find the continuous part that contains four elements?
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
: Yeah , I think that's a great explaination .
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
: Well , I would like to use two for loop , one for the iteration of the entire array , the other for the calculation to sum up the elements in the subarray
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
All right. It sounds reasonable.
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
: Ok , I would like to start with giving some examples
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
: I am wondering if there's a quicker solution?
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
: Umm…maybe I could use the sliding window to remove the first element in the current subarray and add the next element behind the last one in current subarray
程式碼
1.original
2.sliding window
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
: The next question is about Binary Search Tree . Now , you are given the root of a binary tree (BST) and an integer val. Please find the BST that the node's value equals val and return the subtree rooted with that node. If such a node does not exist , return null.
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
: Ok , so I am given a value and a root of a binary tree . Then , I need to search if there's any node that correspond to the value . If it exists , I should just output the root and the following node with preorder traversal .
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
: All right , please go on.
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
: Let me try to do it with some examples
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
in this photo , we find the corresponding value 2 in the trees , and then output the value based on the root with preorder traversal
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
: Yeah , it make sense
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
:Besides , since a BST would have bigger node in the left hand part , and smaller one in the right hand part , so we could use a if else to help it find the targer node quicker
程式碼
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
:There is the final question . Given the head of a linked list . Delete the middle node , and return the head of the modified linked list. The middle node of a linked list of size n is the [n/2]th node from the start using 0-based indexing , where [x] denotes the largest integer less than or equal to x.
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
: Ok , so I got a size n linked list , and I need to get rid of its middle node ?
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
: Yeah , it sounds reasonable .
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
: All right , let me start with some examples.this is the example for odd counts of elements
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
this is for even counts of elements
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
: Then , how will you code this out
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
: I would start from named a new Listnode as front and tail , and assign the node of head to front , then iterate through head to find the size of this linkedlist . After that , I would go to that node before our target , then link it to the node behind our target , and thus delete the node . Besides , we should keep an eye on the case when size equals to 1 , we should just return NULL .
程式碼
初步檢討
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
interviewer
- 引導解題的方式不夠深入
對於演算法的精進可以適度給予提示 ,或是引導interviewee去分析不同演算法的時間與空間複雜度,甚至是應用場景的細節
- 延伸原本問題的技巧
若是能跳脫原本問題的框架,以延伸的想法與interviewee互動,或許更能挖掘出自己想要的人才
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
interviewee
- 寫程式時說話音量太小
要保持interviewer聽得清楚的音量 ,或是盡量在coding前的解釋補充得更清楚 ,就不需再coding時分心解釋
- 表達流暢度的精進
會有過多語助詞以及窮詞的狀況,若能流利地表達能給interviwer自己是 well-prepared and confidence 的印象
第二次作業-他評 01
關於 interviewer
- Part 3 00:20: 與其照著 LeetCode 原題來描述,不如針對應用場景,說明為何要找出單向鏈結串列中間的節點 (並釋放記憶體)
以 FreeRTOS 來說,就用鏈結串列來表示動態建立的任務
- Part 3 3:10: 避免只說 "How will you code this out?",這樣的互動太草率,應該回顧 interviewee 提出的方法後,在適當的分析後,才說 "reasnable"
- Part 3 9:54: 避免過早說 "That's all",聽起來太敷衍,應該針對程式碼討論,掌握 REACTO 流程,特別是 Test 及 Optimization
- Part 3 10:08: 避免過早說 "Look forward",這樣可能會帶來非必要的暗示,應該給予評論和延伸問題
關於 interviewee
- Part 3 1:53: 作為 interviewee,不該直接提及 LeetCode 及其範例,應該要能夠呼應 REACTO 流程
- Part 3 2:10: 在 Google Docs (或者協作的頁面) 中,一邊解說案例,一邊寫下,屆時開發程式時,可對照運用
- Part 3 2:18: 採用 0-based indexing,依據範例應該是左邊 (或右邊) 起算的第 4 個節點,不該說 "the third node"。可用類似以下說法:
In a singly-linked list, when we use 0-based indexing, the first node is considered to be at index 0, the second node at index 1, the third node at index 2, and so on.
So, in the example: 1 -> 2 -> 3 -> 4 -> 5
The first node (index 0) is 1.
The second node (index 1) is 2.
The third node (index 2) is 3.
- Part 3 2:09: 應區分 node 和 element
- A node is a fundamental building block of a linked list. It consists of two components:
- Data: This is the actual information or value that you want to store in the linked list.
- Reference (or Link): This is a pointer/reference to the next node in the sequence (in a singly-linked list) or both the next and previous nodes (in a doubly-linked list).
- An element in the context of a linked list generally refers to the actual data or value stored within a node. It's what you retrieve or manipulate when you work with the linked list.
Elements are the meaningful pieces of information that you are storing and managing using the linked list data structure. ChatGPT
- Part 3 2:48: 若及早定義 middle,並用偶數奇數來解釋,就可及早切入程式碼。
4 / 2 = 2
的讀法是 "four divided by two equals two"
- Part 3 3:26: 字元太小,應適度放大,有利於後續討論。面試的場合通常不會用 LeetCode 網頁
- Part 3 4:04:
front
和 tail
應該宣告在同一行,便於一面解說一面打字
- Part 3 5:01: "We might not… we cannot do the next progress" 聽起來過於武斷,究竟不記錄鏈結串列的長度到底會怎樣?
- Part 3 5:22: 避免頻繁地搖頭,可能會讓人誤會你在多個電腦螢幕之間切換視線,或者旁邊有人給你提示
- Part 3 5:50: 頻繁搖動滑鼠,很討厭,無助於溝通
- Part 3 6:07: "I forget that" 這句話不用說,應該強化 REACTO 流程,讓方法可對應到程式碼
- Part 3 7:35: 關於特例的討論,應該在 REACTO 的 Approach 階段提出
若用 Linux 風格的 cicular doubly-linked list 撰寫,優雅許多:
第二次作業-他評 02
interviewer
- 介紹題目的時候,可以不完全把題目條件講清楚(測資範圍等),讓面試者自行思考極端情況、問清楚條件
- interviewee 完成題目後,可以請對方對演算法做分析,像時間複雜度,或是哪裡可以改進等 (Optimization)
interviewee
- 注意 coding style,固定使用大/小寫當作變數開頭(可能有面試官會在意)