Skip to content

Create 33 2021 1116 Binary Tree #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 29, 2021
Merged

Create 33 2021 1116 Binary Tree #24

merged 4 commits into from
Nov 29, 2021

Conversation

ytyubox
Copy link
Member

@ytyubox ytyubox commented Nov 14, 2021

leetcode 讀書會通知

  1. 項目: 第 33 次聚會
  2. 目的: 線上一起寫題目, 由有想法的人帶領, 先解題, 再看該題有趣的解法
  3. 時間: 11/16 (二) 20:00 ~ 21:00
  4. 地點: google meet 線上 (前 10 分鐘預備鏈接)
  5. 解題項目: Binary Tree
  6. 共筆: GitHub https://github.com/programmingbookclub/Leetcode-club
  7. 備註:

上次聊了一些 Traversal 的解法(Pre/In/Post order), 有一個 Todo,一個 regret
TODO: 不太懂iterative在幹什麼,看有沒有辦法用比較易懂的方式講iterative
REGRET:Google Meet 上面的聊天室忘了備份

關於 TODO,希望可以先蒐集大家的回答(事先留言/現場回應)。這次聚會預期的目標是:

  1. 回顧 recursion 如何轉換成 iteration
  2. 102 持續討論 recursion 與 iteration
  3. 104 101 112 以看到題目的第一個想法為主
  4. 希望可以聊到 4 題 102、104、101、112

@ytyubox
Copy link
Member Author

ytyubox commented Nov 14, 2021

https://www.quora.com/In-technical-interviews-from-big-companies-like-Google-and-Facebook-will-they-ask-to-implement-our-answers-using-a-non-recursive-solution-or-a-recursive-solution-or-can-we-choose-it-ourselves

In all the technical interviews I sat in, this is the common sequence of asking and answering a particular technical question -

(a) Interviewer explains the problem.

(b) Interviewee confirms the statement. Asks for boundary cases, exceptions, etc.

(c) Both discuss various ways of tackling the problem. Mostly it starts with the most simple approach and gradually moving to more optimized answer.

(d) If you couldn't think of more than one approaches in the previous step, then he would ask you to code that up and later they build on it. Otherwise, the interviewer picks one, and asks you to code it up.

(e) After that, they will discuss the pros and cons of different approaches (loop vs recursion, types of DP, etc. depending on the problem), and if you give sufficiently correct answers, then he won't ask you to code the other thing. If not, then to make you realize your mistake, he might ask you to write code for it as well.

I hope this answers your question.

Background - I have been interviewed by Microsoft, Google, Facebook, Oracle and Samsung.

Thanks for A2A.

Source: I conducted 100s of interviews for Facebook and other startups over the last six years.
It's unlikely the interviewer will ask you specifically. Indeed, coming up with the algorithm is probably a large part of the interview itself. Much more likely is that someone will ask you to justify a particular implementation method. I always tried to avoid giving out answers, but instead hinted at it or asked questions that would naturally lead a good candidate to think about the problem in a certain way.
If you're unable to translate between recursive and iterative implementations of the same algorithm, it likely shows a deficiency of understanding and instead hints that you may have merely memorized snippets of code.
If the question does come up I'd suggest thinking about the following topics:
Are there possible stack overflow problems?
Does the algorithm use tail recursion?
Are there potential memoization optimizations?

@ytyubox ytyubox merged commit cc22a85 into main Nov 29, 2021
@ytyubox ytyubox deleted the 33-binary branch November 29, 2021 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant