☕ PayPal and Amazon?

PayPal announces news around Bitcoin and Amazon unveils newest edition to the AWS line up. NextJS 10 is out.

Hey Guys,

Here’s your Interview Problem and Industry News for the day.

Interview Problem

You are given a string with parentheses and lowercase English characters.

You must remove the minimum amount of “(“ or “)” in any position so that the resulting parenthesis string is valid and return any valid string.

A parentheses string is valid if and only if

  • It is the empty string or only contains lowercase characters

  • It can be written as AB where A and B are valid strings

  • It can be written as (A) where A is a valid string.

In order to be entered into our weekly raffle (where you can win a Mock Coding Interview with a Google Engineer or an Amazon Gift card), reply back with your solution!

  • ALL replies will get at least one point (one entry in the raffle)

  • Outstanding replies can earn up to four points (four entries)

Industry News

NextJS 10.0 released

NextJS is an incredibly popular React front-end web framework that allow developers to easily implement things like server-side rendering and static generation for their web applications. Recently, they released their newest version. Here’s a list of the new features…

  • New Image Component - NextJS worked with the Google Chrome team to come up with the next/image component, which replaces the img tag. The image component automatically handles lazy loading, pre-loading of images and correct sizing across devices. There’s also much faster build times since images are optimized on demand (as users request them) rather than during build time. 

  • Internationalized Routing - Built in support for language detection and internationalized routing. This makes building apps that are used by a global audience much easier.

  • NextJS Analytics - an analytics tool that tracks performance metrics continuously from the actual devices of your visitors. This allows you to get a real time performance score from your user’s devices as opposed to something you might get from Lighthouse (which you have to run yourself)

AWS launches newest GPU-equipped P4 instances

AWS has launched their newest GPU equipped instances called P4.

They’re powered by Intel Cascade Lake processors and 8 Nvidia A100 Tensor Core GPUs. The Intel processors have 96 CPU cores and the system has 1.1 TB of memory, enough to fit the largest datasets. These offer up to 2.5x the deep learning performance of the previous generation while offering 60% improvements in price.

However, they’re still quite expensive with on-demand pricing being $32 an hour. 

PayPal CEO Dan Schulman provides new details on the company’s plans around Bitcoin

During PayPal’s recent earnings call, Dan Schuman provided new details on PayPal’s plans around Bitcoin. Starting in the first half of next year, PayPal will allow users to draw from their cryptocurrency holdings (on PayPal) to pay for goods and services at the 28 million merchants who use PayPal. These payments will not have any incremental fees to merchants or customers.

PayPal users will also be able to use cryptocurrency with Venmo (PayPal owns Venmo).

Schulman talked about how PayPal’s crypto offering has generated massive interest. The size of the waiting list is three times greater than what the company anticipated. The service will be available to all U.S. users in the next few weeks.

Previous Solution

As a reminder, here’s the previous problem

Given a binary tree, determine whether or not the tree is height-balanced.

Solution

I probably sound like a broken record by now, but whenever you see a tree-based question, your first thought should be recursion.

How can we use recursion to solve this question?

Well, at each node we must check 3 conditions in order for the tree to be balanced.

  1. Left Subtree must be balanced

  2. Right Subtree must be balanced

  3. Left Subtree height and Right Subtree height must differ by less than two.

If all three of these conditions are true, then we can return True.

Since we’re doing this recursively, in the “caller function”, we may want the height of the current tree. Therefore, we should take the larger of the Left Subtree height and the Right Subtree height and increment it by one (to account for the current root node). Then we should also return that as the height.