Meta launches Muse Spark

ALSO: How to handle network failures

In partnership with

Welcome back!

This week’s coding challenge will test your Maths skills. Let’s see if you can solve it.

Today we will cover:

  • Missing Number

  • How to handle network failures

Read time: under 4 minutes

CODING CHALLENGE

Missing Number

Given an array nums containing n distinct numbers in the range [0, n], return the only number in the range that is missing from the array.

Example 1:

Input: nums = [3,0,1]
Output: 2
Explanation:
n = 3 since there are 3 numbers, so all numbers are in the range [0,3]. 2 is the missing number in the range since it does not appear in nums.

Example 2:

Input: nums = [0,1]
Output: 2
Explanation:
n = 2 since there are 2 numbers, so all numbers are in the range [0,2]. 2 is the missing number in the range since it does not appear in nums.

Solve the problem here before reading the solution.

PRESENTED BY THE CODE

Find out why 200K+ engineers read The Code twice a week

Staying behind on tech trends can be a career killer.

But let’s face it, no one has hours to spare every week trying to stay updated.

That’s why over 200,000 engineers at companies like Google, Meta, and Apple read The Code twice a week.

Here’s why it works:

  • No fluff, just signal – Learn the most important tech news delivered in just two short emails.

  • Supercharge your skills – Get access to top research papers and resources that give you an edge in the industry.

  • See the future first – Discover what’s next before it hits the mainstream, so you can lead, not follow.

SOLUTION

To find the missing number, we can use the mathematical formula for the sum of first n numbers.

The expected sum of numbers from 0 to n is n*(n+1)/2. By subtracting the actual sum of numbers in the array from this expected sum, we get the missing number.

This approach is efficient as it only requires one pass through the array to calculate the actual sum.

Time complexity is O(n) as we need to iterate through the array once.

Space complexity is O(1) as we only use a few variables.

FREE TRIAL

Secrets Management, Certs, and Access in One Tool

Infisical is a unified open-source platform that manages secrets, certificates, and privileged access. Automated cert renewal, granular access controls, and out-of-the-box integrations. Deploys anywhere and battle tested by Fortune 500 enterprises.

SYSTEM DESIGN

How to handle network failures

When network issues prevent servers from communicating with each other, your system needs to handle this gracefully. This is where partition tolerance comes in.

A network partition happens when some servers in your distributed system can't talk to others. Imagine you have servers in two data centers - US and Europe. If the connection between these data centers fails, you have a network partition. The servers still work, but they can't communicate across regions.

There are two main approaches to handle network partitions: CP (Consistent and Partition Tolerant) and AP (Available and Partition Tolerant).

CP systems prioritize consistency. When a partition occurs, they block operations that could make data inconsistent. For example, if you're running an online banking system, you might prefer to show an error message rather than risk showing incorrect account balances.

AP systems prioritize availability. They continue operating during partitions, even if it means data might temporarily be inconsistent. Social media platforms often choose this approach. If you can't post updates for a few minutes, that's better than the entire system being unavailable.

To detect network partitions, systems use heartbeat mechanisms. Each server regularly sends small messages saying "I'm alive" to other servers. If these messages stop arriving, the system assumes there's a partition.

Modern systems often use a quorum-based approach. Instead of requiring all servers to agree, decisions can be made if a majority (quorum) of servers agree. This helps systems stay operational even when some servers are unreachable.

Here's a comparison of CP vs AP systems:

CP

AP

Prioritize consistency

Prioritize availability

May become unavailable

Stays available

Good for financial systems

Good for social media

Block operations during partitions

Continue operations during partitions

Example: MongoDB

Example: Cassandra

FEATURED COURSES

5 Courses of the Week

 Intro to ML with Pytorch: Build programs that predict and find data patterns. Learn basic methods like linear regression and decision trees. Advance to neural networks for images. Practice with Python tools like PyTorch and scikit-learn.

 Agentic AI Engineering: Build 8 AI projects in 30 days. Use OpenAI Agents and CrewAI tools. Create independent AI systems. Build chatbots and automation helpers.

 Python for Data Science & Machine Learning Bootcamp: Learn key Python libraries. NumPy for calculations. Pandas for data. Matplotlib for charts. Scikit-Learn for machine learning. TensorFlow for deep learning.

 AWS ML Engineering: Deploy machine learning models using Amazon's cloud platform. Learn data preparation and model training. Work on real projects. Master automated deployment tools.

 Intro to Machine Learning with Pytorch: Learn machine learning from foundational algorithms (linear regression, decision trees, SVMs) to deep neural networks and unsupervised learning.

NEWS

This Week in the Tech World

Meta launches Muse Spark: Meta unveiled Muse Spark, its first AI model from Superintelligence Labs led by Alexandr Wang. Unlike Llama, Muse Spark is proprietary and will power Meta AI across WhatsApp, Instagram, and Facebook.

OpenAI raises $122 Billion: OpenAI closed a record $122 billion funding round, pushing its valuation to $852 billion. The company is eyeing an IPO later this year as it doubles down on enterprise AI and coding tools.

Anthropic hits $30B run rate: Anthropic's annualized revenue surged to $30 billion, up from $9 billion at end of 2025. The company now has over 1,000 business customers each spending more than $1 million annually.

Samsung profit jumps 8-fold: Samsung posted a record Q1 operating profit of $38 billion, driven by massive demand for AI memory chips. Nearly 95% of profits came from its semiconductor division.

Broadcom expands Google, Anthropic deals: Broadcom will build next-gen TPUs for Google and supply 3.5 gigawatts of compute to Anthropic starting 2027. Broadcom's CEO sees AI chip revenue exceeding $100 billion in 2027.

OpenAI retires GPT-4o: OpenAI completed the full retirement of GPT-4o from all plans. This wraps up a phased sunset that also removed GPT-4.1 and GPT-5 variants. Developers must migrate to newer models.

US AI firms unite against Chinese distillation: OpenAI, Anthropic, and Google are sharing intelligence to fight Chinese labs extracting capabilities from US AI models. Anthropic has blocked Chinese-controlled companies from using Claude.

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,