☕ Reddit Doubles and Rust Jumps
Big Tech jumps on the Rust Programming Language! Plus, Reddit doubles their valuation in a new funding round. Can you guess what the company is valued at?
Hi Everyone!
Hope you’re all having a great day!
Here’s your Interview Problem, Yesterday’s Solution and Tech Snippets for the day!
Industry News
Google, AWS, Microsoft, Mozilla and Huawei join together to create the Rust Foundation
Rust is a programming language that has gained a ton of popularity.
It’s been voted the most loved programming language every year since 2016 on the Stack Overflow Developer Survey.
It started as a side project inside of Mozilla in 2006 by Graydon Hoare. The language is intended for highly concurrent and highly safe systems.
Rust is compiled (machine code not bytecode), has strong static typing, imperative ( has some functional aspects) and has no garbage collection.
The benefits of Rust are
Fast
The performance of idiomatic Rust is comparable to the performance of idiomatic C++
Safety
Pointers in Rust are checked at compile time.
The compiler makes sure that every value has only one owner which means no double frees.
The compiler also makes sure that no pointers outlive the owner, which means no dangling pointers.
Thread Safety
Safe Rust guarantees an absence of data races. However, it does not prevent general race conditions. Read More.
No Hidden States
No Null Pointers in Rust. All references are guaranteed to not be Null.
Therefore, the compiler forces you to put in Null checks and helps you avoid runtime errors.
Low Level Control
No Garbage Collector or Runtime
No garbage collection pauses or memory overhead
Can run on systems without an OS since there’s no runtime. Useful for embedded devices!
Control allocation and dispatch
Variables are all on the stack, but you can opt-in to heap allocation
Can opt-in to dynamic dispatch.
P.S. - Are you enjoying Quastor Daily?
It would be much appreciated if you could share it!
Reddit’s valuation doubles to $6 billion dollars after a new $250 million dollar fundraising round
Reddit has more than 50 million daily active users and a nearly 90% increase in advertising revenue over the past year.
The company was previously valued at $3 billion dollars after a funding round in February 2019.
The company was first founded in June of 2005 and was part of the first batch of YCombinator, along with Twitch and Loopt ( a company started by Sam Altman, now the founder and CEO of OpenAI).
Now, the company has raised $250 million dollars in a Series E fundraising round to make investments in video, advertising and expanding into international markets.
Reddit is also planning on doubling the number of employees this year, with a heavy emphasis on adding programmers.
Interview Question
You are given a linked list as input.
Reverse the nodes in the linked list in groupings of k, where k is an integer that will be provided.
k is a positive integer and will be less than or equal to the length of the linked list.
If the number of nodes is not a multiple of k, then left-out nodes, at the end, should remain as they are.
Example
Input - 1 -> 2 -> 3 -> 4 -> 5, k = 2
Output - 2 -> 1 -> 4 -> 3 -> 5
Input - 1 -> 2 -> 3 -> 4 -> 5, k = 3
Output - 3 -> 2 -> 1 -> 4 -> 5
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 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 previous question
Given an integer, convert it to a Roman Numeral.
Example
Input: 3
Output: “III”
Input: 4
Output: “IV”
Input: 1994
Output: “MCMXCIV”
Here’s the question in LeetCode
Solution
This question can actually be solved by a pretty elegant solution.
We first put all the possible combinations of roman numeral symbols and their integer values in an ordered dictionary (dictionaries are ordered in Python 3.6+ by default).
We put them in order from largest to smallest.
Then, we iterate through our dictionary and for each integer value, we divide the number by that integer value.
That tells us how many of those roman numerals we will need.
For example, 4000 will be represented as MMMM.
4000 / 1000 = 4, which means 4 Ms.
Then, we can add that number of roman numeral symbols to our character array (that represents the final roman numeral).
After, we can set our number to the remainder that’s left.
Then, we continue on to the next roman numeral, integer value pair in our dictionary.
Can you analyze the time/space 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).
Best,
Arpan