Wednesday, April 6, 2022

Leetcode | discuss | 30 days to Meta onsite | 4th Facebook onsite | System design | Daily update - Day 3

April 6, 2022

Here is the link. 


30 days to Meta onsite | 4th Facebook onsite | System design | Daily update - Day 3

April 4, 2022

Introduction

I like to quickly share my preparation for Meta 2022 phone screen and onsite. I like to document my learning on system design, also seek good advice and build confidence based on hard work, good learning strategies and also satisfaction through hard work, preparation, sharing and great social activities within community. Good learning and great success always come after those people hard working, taking risk, determination to make good plans, execution of plans. If you also prepare for system design interview, or algorithm interviews for Meta onsite, please drop a line in the comment area, or share your discuss post on Leetcode. If my notes can help you to practice more on Leetcode algorithms, then let me know as well.

30 days to Meta onsite | System design
I did purchase a few udemy system design and behavior courses, and started to watch those courses.

image

image

I will take some notes and then share in this discuss post if I have time.

I also had chance to watch mock onsite interview from https://www.designclub.mingdaoschool.com/interview/index.html

Books I read last 12 months to prepare system design

Google tech talks watched
Bigtable in action (Google Cloud Next '17) [Here](Bigtable in action (https://www.youtube.com/watch?v=KaRbKdMInuc&t=1965) is the link.
Field promotion - keyword, google search - NoSQL row BigTable key design - Cloud Bigtable & time series data Here is the article.

Google bigtable, GFS, MapReduce paper
My favorite notes from Harvard, Rutgers, etc. university large distributed system lecture notes:
August 5, 2021
I like to take some time to learn Harvard lecture notes about Bigtable. Here is the link.

The following is the lecture notes with my highlights. I also like to write down my study notes to help myself to be a better learner.

Follow up on August 5, 2021 7:15 PM
I just could not believe that it is best lecture note I read in my whole life. Unbelievable!

Bigtable makes a couple data model choices relevant for our understanding.

  • Sparse hashtable. A Bigtable is essentially a sparse 3D hash table, where the dimensions are row names, column names, and versions (timestamps).
  • Strings. All Bigtable row names, column names, and data items are strings (sequences of characters). Bigtable has no true schema: everything’s a string.
  • Put, get, scan. Bigtable supports four fundamental operations: put (store a value in a row/column entry), get (return the value in a row/column entry), delete (delete a row/column entry), and scan (return many values from many row/column entries, in sorted order).

Algorithms I practiced before and after Meta phone screen | C# | Facebook tag | votrubac
I just could not believe that I passed Meta phone screen this year March 21, 2022, so I am preparing for onsite interviews in May, 2022.

Facts to review:

  1. Interviewing dot io mock interview as an interviewees - four times in February, 2022.
  2. Algorithms solved - another over 40 algorithms solved for preparation, submissions count over 100
  3. Book chapter - written by Dr. Li - Follow the book chapter to review algorithms related to array
  4. Lessons learned from March Microsoft onsite interviews - C#, algorithms, bugs in the code, time complexity related to HashSet. Need more practice. Work hard and review more algorithms.
  5. It is more important to pass Meta onsite algorithm interviews compared to system design interview.

10 algorithms practiced most challenge:

    1. Step-By-Step Directions From a Binary Tree Node to Another
      C# | Post order | Study discuss post | Solve TLE problem
    1. Expression Add Operators (Hard level)
      C# | Excellent learning opportunity
      C# | Learning opportunities
    1. Reorder Routes to Make All Paths Lead to the City Zero
      C# | Graph problem | Quick study | Warmup
    1. Shortest Subarray with Sum at Least K
      C# | Design a deque | Review Array - Subarray | 2022 March

Jan. 17, 2022
I came back to work on algorithm since I had to prepare for Microsoft Vancouver online assessment.


257. Binary Tree Paths
C# | Warmup | Backtracking | StringBuilder | Jan 16, 2022

1647. Minimum Deletions to Make Character Frequencies Unique
C# | Copy the idea and warm up | Keep it simple using one hashset and one array | Jan 16 2022

151. Reverse Words in a String
C# | Warmup for onsite | Define start and end char in a word | 2022 Jan 19
C# | Define start and end index of a word | C# StringBuilder Insert API | Insert the word right away


210. Course Schedule II
C# | DFS algorithm | Study Leetcode discuss C# code | Jan. 26, 2022
C# | DFS solution | Java code -> C# code | Jan. 26, 2022

874. Walking Robot Simulation
C# | Warmup algorithm and short review | 2018 Oct. 14

692. Top K Frequent Words
C# | Warmup practice | Sort once | Using simple data structure

636. Exclusive Time of Functions
C# | Opportunistic learning | Study C# code
C# | Lessons learned | My failed practice 54/120 test cases in 2020

263. Ugly Number
C# | Practice in Sept. 14, 2018
Feb. 8, 2022

1405. Longest Happy String
C# | Failed test case 24/35 | Think more carefully in design
C# | Greedy on char with largest count only | Longest is not easy

545. Boundary of Binary Tree
C# | Definition of left boundary | Reasoning behind | Feb. 2022

827. Making A Large Island
C# | Map each island using integer | Hashmap | DFS | Failed a few times

424. Longest Repeating Character Replacement
C# | Sliding window technique | mock interview

98. Validate Binary Search Tree
C# | Mock interview practice | Interviewer with MSFT, Amazon, Oracle, Meta | 2022 Feb. 23

March 4, 2022
Microsoft Vancouver onsite - Four rounds of algorithm interviews
I passed online code assessment in Dec. 2021, but I preferred to have more practice before I had onsite interview. I chose not to move fast because I did not practice very often from May to Dec. 2021. That is a big mistake, I should not stop practice Leetcode algorithms. It takes time to warm up and also it takes time to build habit to think hard on Leetcode algorithms, and also patience is a skill to learn again after six months break.

I continued to practice Leetcode algorithms to prepare Meta phone screen on March 21, 2022..

March 2022, monthly review
March 1 - March 7
It takes self-discipline to work on Leetcode algorithms continuously. I only have less than 200 submissions last 12 months, compared to Dr. Lai (https://leetcode.com/justyy/), over 1500 submissions, I like to learn from him. Hard work is most important, and I should discipline myself and then I can improve my crafting skills and problem solving skills.
Algorithms I worked on, 408, 1650, 1762, 314, 498, 162, 523, 282
I started to work on algorithms from votrubac, top-voted solutions: Another 11 algorithms, 1162, 1553, 992, 934, 1249, 1092, 1062, 959, 983, 1544

March 6, 2022
408. Valid Word Abbreviation
C# | learn from failed test cases


1650. Lowest Common Ancestor of a Binary Tree III
C# | Space complexity O(1)

1762. Buildings With an Ocean View
C# | Using stack

314. Binary Tree Vertical Order Traversal
C# | Preorder traversal | Record total count, horizontal, level in the tree
March 7, 2022
498. Diagonal Traverse
C# | Automatically direction change

162. Find Peak Element
C# | Binary search algorithm

523. Continuous Subarray Sum
C# | Learn from failed test cases
March 5, 2022
Algorithm to plan to work on
I chose to work on Leetcode with tag Facebook, last six month most frequent algorithms.
Algorithm 314, 1762, 1570, 1650, 528, 408, 339, 71, 31, 670;
10 more: 498, 162, 523, 282, 1891, 1011, 708, 1382, 1539, 2060;
10 more: 266, 286, 1868, 1216, 348, 778, 536, 270, 1428, 825;
10 more: 269, 658, 16, 2056, 43, 1060, 380, 1344, 1522, 1944;
10 more: 1644, 2076, 689, 1424, 983, 224, 298, 742, 767, 333;
10 more: 2019, 2033, 238, 1541, 1209, 2071, 296, 1244, 2065, 2081;
10 more: 406, 271, 1498, 735, 163, 1245, 1559, 247, 2025, 1197;
723, 2092, 62, 540, 1985
work hard | Hard work beats talent
Do not think too much. Just work on more algorithms. Solve as many algorithms as I can. Once I solve another 20 algorithms, stop and review what I have learned, and then continue to solve another 20 algorithms.
I wrote a blog to document my plan on March 5, 2022. Good planning is important for success for any project.
I understood that I could not solve all those algorithms, I tried to go over some algorithms quickly, and found those most intersting and practice one or two, and I tried different ideas to learn from others from discuss post.

March 8, 2022
282. Expression Add Operators (Hard level)
C# | Excellent learning opportunity
C# | Learning opportunities
March 16, 2022
39. Combination Sum
C# | Warmup practice | DFS | Backtracking | 2022

128. Longest Consecutive Sequence
C# | Time complexity: O(N) | Python code converted to C#

C# | Time complexity: O(N), N is length of the array
Leetcode 78 subsets, 90 Subset II, 77 combinations, 40 Combinations Sum II, 377 Combination Sum IV
Plan to type those python code from Li Yin's book, and then convert those code into C# code.

March 17, 2022

15. 3Sum
C# | Time complexity: O(N^2) | Review code written in 2016
C# | Warmup in 2022 | Using HashSet to remove duplicate
C# | Time complexity O(N^2) | Remove duplicate by sorting, no use of HashSet
C# | Time complexity O(N^2) | Use HashSet

18. 4Sum
C# | Sorting, sliding window, skip duplicate | Time: O(N^3)

454. 4Sum II
C# | Optimal time complexity: O(N^2), not O(N^3)

March 21, 2022

2096. Step-By-Step Directions From a Binary Tree Node to Another

C# | Preorder | TLE error 287/332
The above practice shows that I have weakness in terms of design recursive function, use post order traversal or preorder, TLE issue.

C# | Post order | Study discuss post | Solve TLE problem

C# | Post order traversal | Solve TLE problem
I practice near 10 algorithms last weekend, and I chose to study discussion post written by votrubac top-voted discuss posts.
I found so many issues and learned how to solve a few more algorithms related to DP, tree and graph problems.
March 21, 2022

1162. As Far from Land as Possible
C# | BFS | All land nodes into Queue | Search together

1553. Minimum Number of Days to Eat N Oranges
C# | Understand the subproblems

992. Subarrays with K Different Integers
C# | At most K | Two subproblems -> difference

934. Shortest Bridge
C# | Apply DFS to visit all nodes in each island | Brute force two nodes' distance

1249. Minimum Remove to Make Valid Parentheses
C# | Using stack | * to replace unmatched parentheses


1092. Shortest Common Supersequence
C# | LCS DP solution first | Learn C# code

1062. Longest Repeating Substring
C# | DP solution | Time complexity: O(N^2)

959. Regions Cut By Slashes
C# | DFS | Understand the problem

983. Minimum Cost For Tickets
C# | DP solution | learn 20 algorithms from one player

1524. Number of Sub-arrays With Odd Sum
C# | New idea to find algorithm to work on | Solutions tag

March 22, 2022
1675. Minimize Deviation in Array
C# | Learn the analysis first | Learn C# code

March 21, 2022
Meta phone screen, one week break, no practice. I did some research what to work on related to system design interview, and I decided to purchase some Udemy courses so that I can learn much better about large distributed system. Based on my analysis of Udemy course, for example, 15000 students, each one pays $15 dollars, the capital is $225,000 for one course. I do think that one of those courses will definitely help me in short time period.

March 31, 2022
1466. Reorder Routes to Make All Paths Lead to the City Zero
C# | Graph problem | Quick study | Warmup

1320. Minimum Distance to Type a Word Using Two Fingers
C# | DP solution | Need more time

April 1, 2022
1371. Find the Longest Substring Containing Vowels in Even Counts
C# | "aeiou" -> one integer, 5 bits, 32 variations | Warmup for Meta onsite

1721. Swapping Nodes in a Linked List
C# | One pass | Kth node and kth to Last | Secret - one follower starts kth node

Day 1
I was so excited since I learned how to take care of my own study, and also happy to share my own experience. I felt much better this time to prepare for system design, I love to spend time to follow lectures on udemy courses related to large distributed system.

Day 2
April 5, 2022
Spend most time to watch the video - course:
Udemy course: Software architecture & technology of large-scale systems
Spend time to watch videos:
Section 7

Module contents overview
Reference system for using tech platforms
Web applications
Solutions for web applications
Apache web server
Apache web server architecture
Apache webserver scalability
Nginx webserver
Nginx architecture
Nginx as reverse proxy and cache
Web containers & spring framework
Jetty & Spring
Node.JS
Node.JS event loop
Cloud solutions for web
Cloud storage
Cloud CDN
Services
Services solutions
Memcached
Memcached architecture
Redis cache & its architecture
Cloud caching solutions
RabbitMQ
RabbitMA architecture
Kafaka architecture
Redis Pub/Sub
Cloud MQ solutions
Datastores
Datastore solutions
RDBMS scalability architecture
NoSQL objectives & trade-offs
Amazon DynamoDB
DynamoDB architecture
Google BigTable
BigTable architecture
HBase
Cassandra
Cassandra features
MongoDB
MongoDB architecture
Analytics
Analytics solutions
Logstash data streaming architecture
Fluented
Elasticsearch
Elasticsearch architecture
Hadoop HDFS
Map-Reduce
Apache Spark
Stream processing
Summary
Technology stack presentation slides

I only had time to watch around one hour on Google BigTable and Bigtable architecture, and I plan to watch a few more.

Algorithm practice: None
Need to figure out how to spend one hour at least to work on algorithms, go over algorithms by taking some breaks, like 15 minutes, 30 minutes one time. Three times a day.

Day 3
It is an exciting day to work on Leetcode algorithm. First, I got this recipe from votrubac solution top-voted. 15 algorithms, I wrote a blog on April 1, 2022, and I made some plans to work on.

image

My plan | From my blog | April1, 2022 | Leetcode algorithm practice: votrubac | Top voted algorithms | Another 15 algorithms
Quickly go over 15 algorithms, think about five minutes for each algorithm;
Sort algorithms by priority, work on high priority ones first;
Work on challenging ones first.
Think about how to reward myself for the hard work
Time start: April 1, 2022 6:43 PM

I did code two algorithms, first one I was not lucky and I coded a brute force solution, and I learned from two comparison solution from votrubac.
1547. Minimum Cost to Cut a Stick
C# | Hard level | DFS + Memo | Opportunistic algorithm review for Meta onsite

Next I worked on a hard level algorithm, and I studied C# solution and wrote my own solution.

Next I followed advice from votrubac, reviewd a few algorithms, 312, 1000, 1039. I came cross my discuss post written in 2019 with 6 up-votes, I just could not believe that I did such great job to write something for this hard level algorithm in 2019. I was three year younger, and passion about algorithms, specially on DP solutions.

  1. Minimum Cost to Merge Stones
    C# dynamic programming solution bottom up - how to hack one?

I just could not believe that I could have same amount time to work on the hard level algorithm again this time. I quickly reviewed and skipped to next algorithm.

  1. Ways to Split Array Into Three Subarrays
    C# | Linear solution | First divide position any, second one is in a range

Day 4
Day 5
Day 6
Day 7
Day 8
Day 9
Day 10
Day 11
Day 12
Day 13
Day 14
Day 15
Day 16
Day 17
Day 18
Day 20
Day 21
Day 22
Day 23
Day 24
Day 25
Day 26
Day 27
Day 28

#MetaOnsite #onsite #Facebook #SystemDesign

system designonsitealgorithm interview30 days preparationspeculationvotrubactop voted votrubac15 algorithms votrubacjianminchenfacebook

No comments:

Post a Comment