Wednesday, May 27, 2020

Leetcode discussion: 236. Lowest Common Ancestor of a Binary Tree

Here is the discussion post.

C# Recursive function design collections from 2019 to 2020

May 27, 2020
It is most challenging task to build good learning material for software engineers. How to design recursive function to solve lowest common ancestor? I like to put together a collection of solutions with the following list of recursive function return:
  1. Return bool
  2. Return void
  3. Return TreeNode
  4. Return Stack
  5. Return Tuple<TreeNode, int>
  6. Good ones vs bad ones - mix returns - break single-responsibility principle SRP
  7. More will be added later
Recursive function is fun to play
Return Tuple<TreeNode, int> or ArrayList? Always strong typing
C# Postorder traversal and count nodes found practice in 2020 Learn from ex-facebook engineer, super performance, April 30, 2020
My advice
Please kindly consider carefully to choose good recursive function to solve the problem in mock interview or onsite interview. Most of important is to focus on quality, not quantity to solve Leetcode algorithms.
Good one to showcase talent
Return Tuple<TreeNode, int> or ArrayList? Always strong typing
C# Postorder traversal and count nodes found practice in 2020 Learn from ex-facebook engineer, super performance, April 30, 2020
Not so good one, memorize a solution - Need hardwork in practice
recursive function - mix returns, final one is lowest common ancestor (May 29, 2019)
recursive function designsrp principlec# strong type tuple

No comments:

Post a Comment