☕ Twitter Innovates?!?

How to contribute to open source. Plus, how to reduce GTA V load times by 70%. We also have a solution to our last Interview question on square roots!

Hey Guys,

Hope you’re all having a fantastic day!

Here’s your Industry News, Tech Snippets and Interview Problems!

As always, feel free to reply to this email with any questions, comments or insults.

I’m all ears!

Industry News

Twitter Innovates?!?

If you’ve been following the discussion around Twitter for the past few years, you’d know that the company has been heavily criticized for failing to innovate at the pace of other big tech companies in the space.

One prominent venture capitalist suggested that there was “a lot of pot-smoking going on there” as a possible reason for why they were failing to build new features.

Investors in Twitter also tried to remove Jack Dorsey (Founder and CEO of Twitter) from his leadership role because they thought he was too distracted from being the CEO of 2 companies (he’s also the CEO and Founder of Square).

Well, now Twitter is finally innovating!

They’re adding a Super Follows feature, which will allow users to charge followers to give them access to extra content. The content could be bonus tweets, access to a community group, subscription to a newsletter or a badge that indicates your support.

Twitter sees this as a way to let creators and publishers get paid directly by their fans.

Twitter also recently acquired Revue, a Dutch startup that allows users to publish and monetize email newsletters.

The company may be getting some inspiration for this direction from Substack, another startup that provides publishing, payment and analytics software to newsletter providers. (In case it’s not obvious, I use Substack to send this newsletter to you).

Twitter also announced a new feature called Communities. This would be a Twitter competitor to Facebook Groups, where users can create and join groups around specific topics. Facebook Groups has been extremely successful for Facebook and so Twitter wants to get in on the action.

The third feature Twitter is rolling out is Spaces. Spaces is a way for Twitter users to start an audio conversation in the app with other twitter users. When you create a conversation, your followers can join in as audience members and listen to the conversation (or you can invite them up to speak). This is a direct competitor to Clubhouse, a startup that has exploded in popularity over the past year. Clubhouse has recently raised a fundraising round with a16z that valued the company at over $1 billion dollars!

P.S. if you want to join Clubhouse, I have a couple of invites. Feel free to reply to this email and I’ll send you one!

Tech Snippets

  • Interested in contributing to open source? Here are some great tips for contributing as a beginner.

    • Read the Contribution Guidelines

    • Create a New Branch - do not fork and make changes to the master branch

    • Get Assigned to Issues Before Working on them - Find an issue in the Issues section of the repository and make sure that it’s unassigned. Then comment on it asking to be assigned.

    • Before Submitting a PR, create an Issue - If you find a bug or have an idea for enhancement, first create an Issue. Then, you can get yourself assigned to solve the issue and then write the fix/feature.

    • You Don't Need to Create A New PR For Every Change - If the maintainer requests changes for your PR, then just modify that. Don’t close the PR and submit a new one.

    • Don’t Commit Unnecessary Files

  • How I cut GTA Online loading times by 70%

    • An awesome article where a developer uses stack sampling to figure out the bottlenecks for GTA V Online’s loading time.

    • One issue was with how Rockstar parsed a 10 megabyte JSON file in an extremely inefficient way.

    • Another issue was with Rockstar searching an entire array one by one instead of using a hash map.

    • The author wrote a .dll file with a fix, injecting it in GTA and reduced the load time by 70%!

Interview Question

You are given the root of a Binary Search Tree and an integer k.

Return the kth smallest element in the BST.

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 the 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”

Previous Solution

As a refresher, here’s the last question

You are given a non-negative integer c.

Write a function that determines whether there are two integers a and b such that

a^2 + b^2 = c

Solution

There’s quite a few ways to solve this question, depending on how good your number theory skills are.

If you’re familiar with Fermat's Theorem on Sums of Two Squares, then you can probably impress your interviewer a bit.

If you’re not a math nerd though, no worries! We can solve this question with some basic algebra.

We want to find a and b such that a^2 + b^2 = c

So, we can rewrite the equation to

sqrt(c - a^2) = b

Now, if we can find an a such that sqrt(c - a^2) is a whole number, then that means we have a viable a and b!

Now we can search through all the possible values of a.

We’re not dealing with imaginary numbers here, so the largest possible value of a is sqrt(c).

Therefore, we have to search all the whole numbers [0, sqrt(c)] and check the equation sqrt(c - a^2) to see if it results in a whole number.

Can you analyze the time complexity of our solution?

Reply back with your estimate!

We’ll tell you if you’re correct (or we’ll tell you the answer if you’re wrong).