Google fires 35% of managers

ALSO: Geospatial Indexing

In partnership with

Welcome back!

This week's coding challenge will take you back to a time when there were no smartphones. Let's see if you can solve this old-school problem.

Today we will cover:

  • Letter Combinations of a Phone Number

  • Geospatial Indexing

Read time: under 4 minutes

CODING CHALLENGE

Letter Combinations of a Phone Number

Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. Return the answer in any order.

A mapping of digits to letters (just like on the telephone buttons) is given below. Note that 1 does not map to any letters.

Example 1:

Input: digits = "23"
Output: ["ad","ae","af","bd","be","bf","cd","ce","cf"]

Example 2:

Input: digits = "2"
Output: ["a","b","c"]

Solve the problem here before reading the solution.

MASTER AI TOOLS

Choose the Right AI Tools

With thousands of AI tools available, how do you know which ones are worth your money? Subscribe to Mindstream and get our expert guide comparing 40+ popular AI tools. Discover which free options rival paid versions and when upgrading is essential. Stop overspending on tools you don't need and find the perfect AI stack for your workflow.

SOLUTION

To solve this problem, we'll use a backtracking approach with a recursive function. We'll first define a mapping between digits and their corresponding letters. Then, we'll create a recursive function that builds all possible letter combinations.

The key idea is to explore all possible combinations by choosing one letter from each digit's mapping. We'll use backtracking to generate these combinations efficiently.

The solution works as follows:

  1. First, we handle the edge case of an empty input by returning an empty list.

  2. We create a mapping between digits and their corresponding letters.

  3. We define a backtracking function that:

    • Adds the current combination to the result when no digits remain

    • For each digit, tries all its possible letters

    • Recursively builds combinations by adding letters

  4. We start the backtracking process with an empty combination and the full input digits.

  5. The result will contain all possible letter combinations.

Time complexity is O(4^n), where n is the length of the input digits. This is because each digit can map to at most 4 letters (like 7 and 9), and we generate all possible combinations.

SYSTEM DESIGN

Geospatial Indexing

Finding nearby restaurants or calculating delivery routes requires efficient handling of location data. Traditional database indexes don't work well for spatial queries like "find all coffee shops within 2 miles". This is where geospatial indexing comes in.

The simplest approach might be to store latitude and longitude as separate columns and create indexes on them. But this doesn't work well because these coordinates are meaningless when considered separately. We need a way to index locations while preserving their spatial relationships.

One popular solution is the R-tree index. It works by grouping nearby objects and representing them as rectangles. These rectangles can contain other rectangles, creating a tree structure. When searching for nearby locations, we only need to check rectangles that overlap with our search area, making queries much faster.

Another approach is Geohashing, which converts a location's coordinates into a single string. The longer this string matches between two locations, the closer they are. For example, the geohash ""9q8yy"" might represent San Francisco, while ""9q8yn"" represents a nearby location. This makes it easy to find nearby places by comparing string prefixes.

Google's S2 library takes a different approach. It projects locations onto a cube that wraps around Earth, then divides this cube into cells of various sizes. Each cell gets a unique ID, and nearby locations share similar IDs. S2 is particularly good at handling queries that cross the international date line or the poles.

Here's how these approaches compare:

Method

Strengths

Weaknesses

Used By

R-tree

Good for complex shapes

Memory intensive

PostgreSQL

Geohash

Simple to implement

Boundary issues

Redis

S2

Handles edge cases well

More complex

Google Maps

FEATURED COURSES

5 Courses of the Week

 Amazon’s DSA: Implement and analyze fundamental data structures and algorithms in Java, including sorting, searching, and recursive techniques with JUnit testing methodology.

 Intro to Containers w/ Docker, Kubernetes & OpenShift: Learn to build and run apps using containers with Docker, and manage them at scale with Kubernetes and OpenShift. Get hands-on experience through browser-based labs.

 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.

 Complete Guide to TensorFlow with Python: Comprehensive TensorFlow course covering neural networks, machine learning, and deep learning techniques for Python students.

WORK SMARTER WITH AI 

Used by Execs at Google and OpenAI

Join 400,000+ professionals who rely on The AI Report to work smarter with AI.

Delivered daily, it breaks down tools, prompts, and real use cases—so you can implement AI without wasting time.

If they’re reading it, why aren’t you?

NEWS

This Week in the Tech World

Google cuts 35% of small team managers: Google eliminates over one-third of managers overseeing teams under three people as part of efficiency push. Company offers voluntary buyouts to 3-5% of employees while reducing bureaucracy and headcount growth.

Reliance partners with Google and Meta: Indian conglomerate announces $100 million AI joint venture with Meta and cloud partnership with Google. Reliance plans Jio IPO for early 2026 while expanding AI capabilities across energy and telecom sectors.

AI impacts young worker jobs: Stanford study finds 13% employment decline for workers aged 22-25 in AI-exposed jobs like customer service and accounting. Experienced workers in same fields remain stable as AI replaces entry-level "book learning" roles.

Alibaba cloud drives earnings beat: Alibaba reports 26% cloud revenue growth and 78% profit jump as AI demand accelerates. Chinese e-commerce giant's shares surge 19% despite missing revenue estimates at $34.6 billion quarterly sales.

Oracle cuts thousands in fresh September layoffs: Tech giant eliminates 101 Seattle positions with additional cuts reported across Kansas, Massachusetts, and Texas, following 450 August layoffs in Bay Area and Seattle. Despite workforce reductions, Oracle stock hits record high above $250 as CEO cites "astronomical" AI infrastructure demand.

Microsoft fires office break-in employees: Microsoft terminates two workers who broke into President Brad Smith's office during pro-Palestinian protest. The incident followed broader demonstrations by No Azure for Apartheid group opposing Israeli software use.

Alibaba develops new AI chip: Chinese tech giant creates inference-focused AI chip for internal use through cloud services. The semiconductor competes with Nvidia offerings as Chinese firms develop homegrown alternatives amid US export restrictions.

HEARD OF PACASO?

The Key to a $1.3 Trillion Opportunity

A new real estate trend called co-ownership is revolutionizing a $1.3T market. Leading it? Pacaso. Created by the founder behind a $120M prior exit, they already have $110M+ in gross profits to date. They even reserved the Nasdaq ticker PCSO. And you can invest until September 18.

Paid advertisement for Pacaso’s Regulation A offering. Read the offering circular at invest.pacaso.com. Reserving a ticker symbol is not a guarantee that the company will go public. Listing on the NASDAQ is subject to approvals.

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,