☕ Paypal Mafia

A Google Interview Question. Palantir and Asana are now trading on public markets, giving early employees a way to sell their shares.

Hey,

Hope you’re having an awesome day!

I’m super excited to announce that I’m writing a book on Coding Interviews!

It’s completely free and is all online.

The first chapter on Big O Notation has been posted and I’d really love some feedback.

Would really appreciate a reply to this email with ANY feedback you have. Criticism would be especially appreciated. Thanks!

Anyway, on to the Interview Problem…

Interview Problem

Given a string IP, return "IPv4" if IP is a valid IPv4 address, "IPv6" if IP is a valid IPv6 address or "Neither" if IP is not a correct IP of any type.

We’ll send out the solution (with working code & test-cases) 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

Palantir and Asana debut on Public Markets through a Direct Listing - In a massive day for Direct Listings, start ups Palantir and Asana have both debuted on public markets.

Both of these companies are founded by some of the top entrepreneurs in the valley. Palantir lists Peter Thiel (founder of PayPal and head of the “PayPal Mafia”) as a co-founder while Asana was founded by Dustin Moskovitz (co-founder of Facebook).

These companies both debuted on Public Markets by going the Direct Listings route rather than the traditional “IPO” path. With Direct Listings, a company doesn’t seek funding for itself, instead it’s mainly a path to give employees and other insiders a way to sell their shares. Both of these companies are well capitalized, so they didn’t need to go the traditional IPO route.

When trading opened for these companies, Palantir was up 50% and Asana was up 37% showing the investor demand in both of these companies. Employees at both companies then had a great opportunity to finally convert their shares into cash.

Previous Solution

As a refresher, here’s the previous question

You are given an array that contains an expression in Reverse Polish Notation.

Return the result from evaluating the expression. You can assume the expression will always be valid.

Input - [“2”, “3”, “+”, “3”, “*”]

Output - 15 because ( (2 + 3) * 5)

Input - [“4“, “5“, “/“, “30“, “+“]

Output - 30.8 because ( (4 / 5) + 30)

Solution

The key to solving this question is a stack!

We need Stacks on Stacks on Stacks as Soulja Boy would say.

Just kidding, we only need one Stack.

Remember, Stacks are Last In, First Out. So they work perfectly for Reverse Polish Notation.

We iterate through our input array and run an if condition

  • if the current element is an integer, add it to the stack

  • if the current element is an operation (+, /, * or -) then pop the last 2 numbers off the stack, apply that operation, and then push the result onto the stack

After iterating through the array, we should be left with only 1 number in our stack.

That’s the answer!