☕ Learn System Design?

AWS has an amazing, free series on System Design! Plus, a solution to our last coding interview question and a new interview question by Facebook!

Hey Guys,

Really sorry for missing the emails last week!

Unfortunately I ended up catching COVID (right when vaccines are rolling out of course), and was pretty much knocked out for all of last week.

Feeling a lot better now, so we’re back to it!

Thank you for your patience!

Tech Snippets

  • AWS’s This is My Architecture series is pretty fantastic. CTOs of various companies come and discuss how they’ve architected their systems.

  • Amazing article on Software Engineering compensation in Europe.

    • Software Engineering compensation can be split into three groups

      • Companies only benchmarking against local competition - Non-tech companies that view engineering as a “cost center”.

      • Companies benchmarking against all local companies - Companies like Disney, Nike, Booking, etc. These companies pay better but still aren’t tech companies. They’re not competing for the best engineering talent.

      • Companies benchmarking on a regional/global scale - Big Tech companies like Facebook/Google are in this grouping. These companies invest the most in engineering talent.

    • COVID-19 has been great for European Software Engineering salaries as Big Tech companies have been shifting more roles to the EU. Stripe, Spotify and Coinbase are a couple examples of companies that are going much harder on European roles.

Interview Question

You are given the root of a binary tree.

We define the “difference” of nodes A and B as

difference = |A.val - B.val|

Find the largest difference between any two nodes A and B in the tree, as long as A is an ancestor of B.

We’ll send a detailed solution tomorrow, so make sure you move our emails to primary, so you don’t miss them!

Gmail users—move us to your primary inbox

  • On your phone? Hit the 3 dots at the top right corner, click "Move to" then "Primary"

  • On desktop? Back out of this email then drag and drop this email into the "Primary" tab near the top left of your screen

Apple mail users—tap on our email address at the top of this email (next to "From:" on mobile) and click “Add to VIPs”

Previous Solution

As a refresher, here’s the last question

You are given the root of a Binary Search Tree and an integer k.

Return the kth smallest element in the BST.

Solution

We can solve this question with an iterative in-order (smallest to largest) traversal.

If you don’t know how to implement an iterative in-order traversal, check this out.

While we run our traversal, we use a counter variable to keep track of how many nodes we’ve processed.

Once we’re on the kth node, we return the value.

Can you analyze the time complexity of our solution?

Reply back with your estimate!

We’ll tell you if you’re correct (or we’ll tell you the answer if you’re wrong).