• InstaByte
  • Posts
  • Apple partners with Google for AI

Apple partners with Google for AI

ALSO: What is a CDN?

In partnership with

Welcome back!

This week's problem can be solved with two different approaches. Which one do you prefer: recursive or iterative?

Today we will cover:

  • Flatten Binary Tree to Linked List

  • What is a CDN?

Read time: under 5 minutes

CODING CHALLENGE

Flatten Binary Tree to Linked List

Given the root of a binary tree, flatten the tree into a "linked list":

  • The "linked list" should use the same TreeNode class where the right child pointer points to the next node in the list and the left child pointer is always null.

  • The "linked list" should be in the same order as a pre-order traversal of the binary tree.

Example:

Input: root = [1,2,5,3,4,null,6]
Output: [1,null,2,null,3,null,4,null,5,null,6]

Solve the problem here before reading the solution.

PRESENTED BY SUPERHUMAN

Become the go-to AI expert in 30 days

AI keeps coming up at work, but you still don't get it?

That's exactly why 1M+ professionals working at Google, Meta, and OpenAI read Superhuman AI daily.

Here's what you get:

  • Daily AI news that matters for your career - Filtered from 1000s of sources so you know what affects your industry.

  • Step-by-step tutorials you can use immediately - Real prompts and workflows that solve actual business problems.

  • New AI tools tested and reviewed - We try everything to deliver tools that drive real results.

  • All in just 3 minutes a day

SOLUTION

We can solve this problem recursively or iteratively. The recursive solution is simpler to understand and that’s what we’ll cover today.

For each node, we will:

  1. Recursively flatten the left subtree.

  2. Recursively flatten the right subtree.

  3. Set the node.left to null

  4. Adjust node.right to match our required format: node —> Flattened left subtree —> Flattened right subtree

The time complexity of this solution is O(n) where n is the number of nodes in the tree.

SYSTEM DESIGN

What is a Content Delivery Network or CDN?

Imagine you're building the next big video streaming service - something like YouTube or Netflix. You've got all these amazing videos that people want to watch, and you're storing them safely in a cloud storage service like Amazon S3. Sounds great so far, right?

But here's where things get tricky. Let's say you have a user in India who wants to watch their favorite cat video. If your video is stored in a data center in the US, that video has to travel halfway across the world before it reaches their screen.

When videos have to travel such long distances, a few annoying things might happen. First, there's the waiting. You click play, and the video takes forever to start. Then comes the dreaded buffering - you know, that spinning circle that shows up right at the most exciting part of the video? This happens because the video data has to hop through multiple networks and cross oceans before reaching your device.

This is where CDNs (Content Delivery Networks) come to the rescue. Instead of having just one central storage location, CDNs maintain multiple copies of your content in different locations called "edge servers".

Now, when our friend in India wants to watch that cat video, they don't have to reach all the way to the US. Instead, they get the video from a nearby CDN server in Asia, maybe from Singapore or Bangalore.

CDNs don't store every single video at every location - that would be expensive and inefficient. Instead, they learn what content is popular in different regions and store it accordingly. If a particular video becomes viral in India, the CDN automatically ensures that multiple copies are available in servers across India.

HEARD ABOUT THE CODE?

What 100K+ Engineers Read to Stay Ahead

Your GitHub stars won't save you if you're behind on tech trends.

That's why over 100K engineers read The Code to spot what's coming next.

  • Get curated tech news, tools, and insights twice a week

  • Learn about emerging trends you can leverage at work in just 10 mins

  • Become the engineer who always knows what's next

FEATURED COURSES

5 Courses of the Week

 ChatGPT Prompt Engineering for Developers: Learn how large language models work under the hood, master the art of prompt engineering, and build practical applications using LLM APIs.

 Applied Machine Learning in Python: Learn to build predictive models and data clusters using machine learning, while understanding how to create the right features for your analysis needs.

 Meta Android Developer Professional Certificate: Master Android app development using Kotlin through hands-on projects, while learning industry-standard architecture patterns and testing practices.

 Python Data Fundamentals: Master essential Python data analysis skills through hands-on practice with Pandas, Seaborn, and Statistics.

 AI Fundamentals: Get a practical introduction to AI concepts including ChatGPT, large language models, and generative AI to understand how they're reshaping technology.

NEWS

This Week in the Tech World

Apple Partners with Google for Siri: Apple will use Google's Gemini models to power a revamped Siri and future Apple Intelligence features in a multi-year deal.

Meta Cuts 1,000+ VR Jobs: Meta laid off over 1,000 Reality Labs employees and shut down VR studios Sanzaru, Twisted Pixel, and Armature to pivot toward AI.

xAI Builds $20B Mississippi Data Center: Musk's xAI is investing $20B in a data center called MACROHARDRR, pushing its Colossus supercomputer to 2GW of compute power.

Boston Dynamics Partners with DeepMind: Google DeepMind will power Boston Dynamics' Atlas robots with Gemini AI models, targeting factory deployment by 2028.

Samsung Shows Creaseless Foldable: Samsung Display unveiled a foldable OLED with no visible crease at CES 2026, expected for Galaxy Z Fold 8 and possibly iPhone Fold.

Ford Announces Level 3 Driving: Ford will offer eyes-off Level 3 autonomous driving by 2028 on its upcoming $30K electric pickup using in-house developed tech.

TSMC Reports Strong AI Chip Revenue: TSMC beat quarterly revenue expectations as AI chip demand accelerates, signaling sustained infrastructure spending through 2026.

AI Data Centers Need $3T by 2030: Industry projections show AI data centers will require roughly $3 trillion in investment through 2030 for compute and power.

500K Tech Workers Laid Off Post-ChatGPT: Half a million tech workers have been laid off since ChatGPT's 2022 launch, though economists say AI is often an excuse, not cause.

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,