The biggest layoff of 2026

ALSO: Consensus Algorithms

In partnership with

Welcome back!

As Amazon kicks off its 2026 layoffs, we’ll solve a problem from Amazon interviews.

Today we’ll cover:

  • Construct Binary Tree from Preorder and Inorder Traversal

  • Consensus Algorithms

Let’s do this!

Read time: under 4 minutes

CODING CHALLENGE

Construct Binary Tree from Preorder and Inorder Traversal

Given two integer arrays preorder and inorder where preorder is the preorder traversal of a binary tree and inorder is the inorder traversal of the same tree, construct and return the binary tree.

Example 1:

Input: preorder = [3,9,20,15,7], inorder = [9,3,15,20,7]
Output: [3,9,20,null,null,15,7]

Example 2:

Input: preorder = [-1], inorder = [-1]
Output: [-1]

Solve the problem here before reading the solution.

PRESENTED BY 1440 MEDIA

Looking for unbiased, fact-based news? Join 1440 today.

Join over 4 million Americans who start their day with 1440 – your daily digest for unbiased, fact-centric news. From politics to sports, we cover it all by analyzing over 100 sources. Our concise, 5-minute read lands in your inbox each morning at no cost. Experience news without the noise; let 1440 help you make up your own mind. Sign up now and invite your friends and family to be part of the informed.

SOLUTION

To construct a binary tree from preorder and inorder traversals, we'll use a recursive approach.

The first element in preorder traversal is always the root. We can find this element's position in inorder traversal to determine which elements belong to left subtree and which belong to right subtree.

For each recursive call, we'll create a new node, recursively construct its left and right subtrees using the corresponding portions of preorder and inorder arrays.

We'll use a hashmap to store indices of elements in inorder traversal for O(1) lookup. This makes the time complexity O(n), where n is the number of nodes in the tree.

SYSTEM DESIGN

Consensus Algorithms

In distributed systems, multiple servers need to agree on data and actions even when some servers fail or network issues occur. This is where consensus algorithms come in. They help servers reach agreement despite these challenges.

Let's look at three popular consensus algorithms: Paxos, Raft, and Byzantine Fault Tolerance (BFT).

Paxos is the oldest and most proven consensus algorithm. It works by having servers play different roles - proposers suggest values, acceptors vote on proposals, and learners track the final decisions. While Paxos is very reliable, it's complex to understand and implement correctly. This complexity led to the development of simpler alternatives.

Raft makes consensus easier to understand by breaking it into smaller, more manageable parts. It uses a leader-based approach where one server is elected as leader and manages all changes. If the leader fails, a new election happens automatically. Other servers simply follow the leader's instructions. This simpler design makes Raft more practical to implement, though it may be slightly less efficient than Paxos.

Byzantine Fault Tolerance handles an even tougher problem - reaching consensus when some servers might be malicious or compromised. It requires more servers and message exchanges than Paxos or Raft, but can handle situations where servers might deliberately try to disrupt the system. This makes it valuable for blockchain and cryptocurrency systems.

Here's how these algorithms compare:

Feature

Paxos

Raft

BFT

Complexity

High

Medium

Very High

Performance

High

Medium

Lower

Fault Tolerance

Crash failures

Crash failures

Malicious faliures

Use Cases

Google Chubby, Zookeeper

etcd, Consul

Blockchain

Leadership

Multi-Leader

Single leader

No leader

FEATURED COURSES

5 Courses of the Week

 Penn’s Python & Java Programming: Start with Python basics and advance to Java object-oriented programming. Build functional applications including banking systems and data analysis projects.

 Duke’s LLMOps Specialization: Deploy and manage large language models across cloud platforms. Gain practical experience building AI applications on Azure, AWS and Databricks.

 Imperial College’s Maths for ML: Master the essential math (linear algebra, calculus, dimensionality reduction) needed for advanced machine learning and data science.

 IBM Applied Data Science with R: Learn R programming for data analysis, SQL integration, and visualization. Build a complete data science portfolio with practical projects.

 IBM Data Analyst Certificate: Master Python, SQL, Excel and visualization tools for entry-level data analysis roles. Includes hands-on projects and earns college credits.

NEWS

This Week in the Tech World

Amazon Layoffs Continue: Amazon is cutting 16,000 corporate jobs as part of its anti-bureaucracy push. This follows 14,000 layoffs in October. US employees get 90 days to find new roles internally.

Meta Faces Landmark Trial: A jury trial begins over claims that Instagram, YouTube, and TikTok deliberately designed addictive features harming children. Zuckerberg is expected to testify. TikTok and Snapchat settled.

Nvidia Invests $2B in CoreWeave: Nvidia invested $2 billion in CoreWeave to help build 5+ gigawatts of AI data center capacity by 2030. The deal deepens alignment on infrastructure and software.

Intel Surges on Foundry Deals: Intel stock jumped 11% on reports that Apple and Nvidia may shift some chip production to Intel's foundry. Reports suggest 2028 production timelines.

China Approves Nvidia H200 Chips: China approved ByteDance, Alibaba, and Tencent to buy 400,000+ Nvidia H200 AI chips. The move signals Beijing balancing AI needs against domestic chip development.

Windows 11 Update Chaos: Microsoft released two emergency patches after January updates caused boot failures, Outlook crashes, and shutdown bugs on Windows 11 devices.

Mozilla Bets $1.4B on Open AI: Mozilla announced plans to deploy $1.4 billion to fund a "rebel alliance" of open-source AI developers challenging OpenAI and Anthropic.

Reddit Stock Drops on AI Fears: Wells Fargo downgraded Reddit, warning that Google's AI search tools could permanently reduce traffic to the platform and hurt ad revenue.

EU Opens Google DMA Proceedings: EU regulators launched formal proceedings requiring Google to explain how it complies with Digital Markets Act rules on data access and interoperability.

BONUS

Just for laughs 😏

HELP US

👋 Hi there! We are on a mission to provide as much value as possible for free. If you want this newsletter to remain free, please help us grow by referring your friends:

📌 Share your referral link on LinkedIn or directly with your friends.
📌 Check your referrals status here.

YOUR FEEDBACK

What did you think of this week's email?

Your feedback helps us create better emails for you!

Login or Subscribe to participate in polls.

Until next time, take care! 🚀

Cheers,