☕ Elon Musk's School
Elon Musk's school is going mainstream with remote learning. Simulate evolution in Rust and TailwindCSS's solution to large development CSS files. Plus a solution to yesterday's interview question.
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!
source - XKCD
Industry News
Josh Dahn (co-founder with Elon Musk for Ad Astra) raises a fundraising round for Synthesis
Ad Astra (now known as AstraNova) is a school created by Elon Musk and Josh Dahn that focuses on teaching children critical thinking, independent thought and problem solving skills.
All of Elon Musk’s children attend Ad Astra, and the school has only been open to children of SpaceX employees (the school is located on the SpaceX campus).
Now, Josh Dahn wants to bring this educational experience to everyone.
Josh Dahn has teamed up with Chrisman Frank, an early employee at ClassDojo, to create an online school that puts children ages 7 - 14 through a course that teaches leadership, teamwork, independent thought, critical thinking and other useful skills.
The company has grown incredibly fast, with 50% monthly compounded growth since the start of November. They’re now doing over a $1 million dollars in annual run rate.
More than 85% of the students stay in the program after 90 days.
The school is now raising a round of fundraising. Current investors include Alexis Ohanian (co-founder of Reddit), Sam Teller (Elon’s former Chief of Staff), Austin Rief (founder of Morning Brew) and many others.
You can view the company here.
Tech Snippets
The Next Generation of TailwindCSS: Just-In-Time
TailwindCSS is an amazing CSS framework that allows you to write CSS using Utility classes placed directly in your HTML. It’s been exploding in popularity over the past 2 years.
One of the hardest constraints is the size of the generated CSS file in development, which can reach 10mb or more.
Tailwind is fixing these issues with a just-in-time compiler for TailwindCSS that compiles your CSS on-demand as you author your files, instead of generating the entire stylesheet up front.
Simulating Evolution in Rust - an awesome series on genetic algorithms and neural networks. Implemented in Rust, but no background knowledge is required.
Interview Question
You’re given an infinite complete binary tree.
Every level of the tree is filled with values from 1 to infinity.
However, the ordering of the nodes has been flipped for even numbered rows, where they go from largest to smallest.
Given the label of a node in this tree, return the labels in the path from the root of the tree to that row.
Example
Input: 14
Output: [1, 3, 4, 14]
Can you solve this in O(log n) time?
Here’s the question in LeetCode.
We’ll send a detailed solution in our next email, 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
Given the root of a Binary Tree, return the sum of the values in the trees’ deepest leaves.
Example
Answer = 15 since 7 + 8 = 15
Here’s the question in LeetCode
Solution
We can solve this question with a Breadth First Search or a Depth First Search.
We’ll do a DFS here with a preorder traversal.
We’ll first create a list with two elements.
The first element keeps track of the deepest depth we’ve come across in our traversal.
The second element keeps track of the sum of the leaves at that depth.
Now, we can implement our preorder traversal.
In our traversal, we add an extra parameter to keep track of the depth of the current node.
When we process the node, we first check if the node is a leaf.
If so, then we check if the depth of it is greater than the deepest depth we’ve come across (in our list).
If so, then we set the deepest depth to the current depth and we set the leaf sum to our current node’s value.
Otherwise, we check if the depth of the current node is equal to the deepest depth we’ve come across.
If this is the case, then we add the current node’s value to to our leaf sum.
If the node isn’t a leaf, then we just continue traversing through it’s children.
After the traversal, we can return the leaf sum of the deepest nodes.