☕ 5G iPhones?

A System Design Interview Question. Apple set to announce new iPhones. Chargebee raises a lot of money.

Hey,

Hope you’re having a fantastic day!

On to the Interview Problem and Industry News!

Interview Problem

What does ACID stand for? Go through each of the letters in ACID and talk about what they each mean in the context of databases.

We’ll send out the 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 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”

Industry News

Apple to unveil new iPhones - Apple has now announced an October event, where they’re expected to unveil the next generation of iPhones. The event will be on October 13th and will be streamed from Apple’s headquarters in Cupertino, California.

These new iPhones will be the first to embrace 5G technology, offering a massive speed up in upload and download speeds. Some 5G towers are delivering peak download speeds in the 1-2 Gbps range at certain locations.

Additionally, the next generation of iPhones are expected to have LIDAR depth sensors for augmented reality and photo apps, allowing developers to build far more immersive AR technology.

Chargebee raises $55 million dollars - Chargebee is a subscription management and recurring billing tool that automates things like funneling users towards plans and collecting payment information. It does this with integrations through Stripe, Braintree, WorldPay, PayPal and other payment infrastructure providers.

The company has now raised $55 million dollars, in a round led by Insight Venture Partners. Chargebee’s total funding to date is $105 million dollars.

Previous Solution

As a refresher, here’s the previous question

Given a Palindromic string, replace exactly one character in the string by any lowercase letter so that the string becomes the lexicographically smallest possible string that isn’t a palindrome.

Examples

Input - “racecar”

Output - "aacecar"

Input - "zzzzzzzzz"

Output - "azzzzzzzz"

Solution

In order to get the solution, you should first go through some examples. Write down some palindromes and try and figure out how to “break” them while making sure the string is the smallest possible (lexicographically). Try and see if you can see a pattern and come up with an algorithm.

Something you might notice is that you should go through the palindrome and replace the first character that isn’t an “a” with an “a”. That will make sure your new string is the “lexicographically smallest” and it will also break the palindrome.

But are there any situations where this fails?

Yep! It fails if the palindrome is of odd length and the character you’re replacing is the middle one. So, something like “aaabaaa”. In that scenario, replacing the “b” with an “a” will turn into “aaaaaaa”, which is still a palindrome.

So, in that case, we can just replace the last character with a “b”, and that solves the problem. “aaabaaa" would turn into “aaabaab”, which is the lexicographically smallest string we can switch to that is not a palindrome.