☕ Airbnb and Hyperloop
Airbnb prepares for their IPO and Virgin Hyperloop has their first test with human passengers.
Good Morning Planet Earth!
Hope you’re all having a fantastic day!
Let’s get to the Interview Question, Daily News and Previous Solution!
Interview Question
You’re given an array of strings as input. The strings will only contain lowercase letters from a-z. Group all the anagrams in the array together and return the resulting array. An anagram is a word that can be formed by rearranging the letters of another word.
Input: [“yx“, “abe”, “act”, “eab”, “x“, “eba“, “tca“, “xy“]
Output:
[
[“abe”, “eab”, “eba”],
[“act”, “tca”],
[“xy”, “yx”],
[“x”]
]
Here’s the question in LeetCode.
We’ll send a detailed 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
Airbnb readies IPO
2020 has been a blockbuster year for IPOs. You’ve had Palantir, Asana and Snowflake all go public due to low interest rates and lots of money flowing into the stock market.
Airbnb is now prepping to end the year with a bang and plans to make its IPO registration public next week. The company is looking to raise around $3 billion dollars at a valuation of more than $30 billion dollars, making this one of the largest market listings of 2020.
Airbnb has gotten a lot of interest this year due to the massive shift they’ve had in their business model. The COVID pandemic has put a halt on the travel industry, causing the company to lose the majority of their revenue. They were forced to lay off thousands of employees and pivot out of city apartments (the majority of travel is to cities).
The company shifted focus to holiday home rentals and has seen demand for house listings surge.
Virgin Hyperloop announces that it has conducted a test of it’s transportation system with human passengers.
PayPal/Tesla/SpaceX Founder Elon Musk published his paper on the Hyperloop idea in 2013, describing a futuristic transportation system of magnetically levitating pods that travel through airless tubes at speeds of up to 760 mph (1,223 km/h).
In 2014, Virgin Hyperloop was founded to turn this idea into reality. Now, they’ve conducted their first test with human passengers. Virgin Hyperloop’s CTO Josh Giegel and head of passenger experience Sara Luchian were the test subjects.
The test track is 500 meters long and 3.3 meters in diameter. It’s located 30 minutes from Las Vegas. The company has been able to reach speeds of 240 miles per hour on the test track, but plans to do customer trips at 100 miles per hour (optimizing for comfort).
Previous Solution
As a reminder, here’s the previous question
You are given an array of integers where every integer occurs three times except for one integer, which only occurs once. Find and return the non-duplicated integer.
Input - [6, 1, 3, 3, 3, 6, 6]
Output - 1
Input - [13, 19, 13, 13]
Output - 19
Do this in O(N) time and O(1) space.
Solution
We can find the unique number in an array of two duplicates by XORing all the numbers in the array. This will cancel all the bits that have an even number of 1s, leaving the unique (odd) bits out. But how do we use this for three duplicates?
Well, instead of cancelling out all the bits with an even number of bits, we want to cancel out those that have a number of bits that are a multiple of three.
Let's assume all integers fit in 32 bits. Then let's create a list that is 32 zeroes long, and when iterating over each number in our array, we can add up all the bits to its proper spot in the array. Finally, we'll go over each bit in the array and make it equal to itself modulo 3. This means that any bit that has been set some multiple of 3 times will effectively be cleared, leaving only the bit from the unique number.
You can check the code out (and run it!) using this REPL.
The time complexity is linear and the space complexity is constant.
Thanks for reading and be sure to reply back with any feedback! I love critical feedback!
Best,
Arpan