0% found this document useful (0 votes)
187 views

Tech Made Simple Jan 2023

The document discusses the CAP theorem, which states that distributed systems can only guarantee two of three desirable properties: consistency, availability, and partition tolerance. It explains these properties and why systems must make a tradeoff between them. The document also previews that a follow-up post will provide more details on CAP.

Uploaded by

Maqsood Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
187 views

Tech Made Simple Jan 2023

The document discusses the CAP theorem, which states that distributed systems can only guarantee two of three desirable properties: consistency, availability, and partition tolerance. It explains these properties and why systems must make a tradeoff between them. The document also previews that a follow-up post will provide more details on CAP.

Uploaded by

Maqsood Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 122

1

Table of Contents
● Table of Contents

● About This Ebook

● How to effortlessly integrate Self-Study into your routine [Storytime Saturdays]

● 5 Easy Tips for Writing Cleaner Code [Technique Tuesdays]

● Problem 71: Permutation in String [Microsoft]

● [Solution]Problem 71: Permutation in String [Microsoft]

● Salesforce CEO profits from laying off 7000+ people [Finance Fridays]

● How to be an amazing Junior Developer/Intern [StoryTime Saturdays]

● Strategies for Replication in Distributed Databases [System Design Sundays]

● Solving f'(x)= f^(-1)(x) [the inverse of f(x)] [Math Mondays]

● Some simple techniques to make sure your systems are much better.

● Microsoft to integrate Open AI products [Finance Fridays]

● How to Learn Data Structures and Algorithms [Storytime Saturdays]

● System Design Mock Interview: Design TikTok ft. Google TPM[System Design Sundays]

● How to Invent Math[Technique Tuesdays]

● Problem 72: Permutation in String [Amazon]

● [Solution]Problem 72: Permutation in String [Amazon]

● How I networked with one of the most prominent Data Scientists online[Storytime

Saturdays]

● How to ARCHITECT a search engine like Google Search[System Design Sundays]

● Group Theory. The Math Twin to Object Oriented Programming[Math Mondays]

1
2

About This Ebook


Very few people read this section, so I’ll keep it simple.

To those of you that don’t know me, hi I’m Devansh (you can find my
LinkedIn here). Amongst the many things I’m involved in, I happen to be
a writer covering various topics in Technology, Software Engineering, and
AI. I’ve helped people ace their coding interviews, get their dream jobs,
progress in their careers, gain a better understanding of Tech, and even
find the One Piece!! And hopefully, I can now help you.

This ebook is a collection of the posts I published throughout Jan 2023,


in my email newsletter, Technology Made Simple. This includes the
writing normally behind a paywall. I hope you will found value in my
writing, just as all my readers and students have. Every chapter will be
the post of a new day. All my posts will have a lot of hyperlinks that you
can use to study a particular topic further or verify any claims that I
make. The end of every post will be a CTA (call-to-action) along with my
social media links. You can skip that if you want (but I will cry every time
you do).

I’ll end the introduction here. If you like my writing, I would appreciate
you spreading this ebook. It’s completely free, so no harm to anyone.

2
3

Happy Reading <3

3
4

How to effortlessly integrate Self-Study into


your routine [Storytime Saturdays]

How you can balance your hobbies, family commitments, health, and career with
your self-study

The cult is officially back!!!


To commemorate this, I have a very special piece for you. A lot of people
have reached out to me to ask how I balance my time, with all the
commitments I have going. And how they can actually set time aside to
study consistently when they have to balance a lot of obligations.
To those of you that don’t know, I recently appeared on Ken Jee’s
podcast. One of the topics we covered was my approach to balancing
time. My answer was pretty well-received, so I decided to go into it in
more detail here.

4
5

In this piece, I will go over 7 actionable things you need to do to allow


yourself to find time and balance your various commitments. This will
allow you to set up your life in a way that allows you to constantly grow
and learn while not burning yourself out.

Keep in mind, this article is not the 7 commandments, but more of a


checklist that I recommend. I will be going into more detail on these
actionable steps in their own dedicated writeups. This is just an easy
one-stop shop for anyone that wants to refer to them in one place.

Photo by Aaron Burden on Unsplash

5
6

The 7 Action Points for effortless growth

1. Pick your poisons- Understand that everything you do has a hidden


cost. By choosing to spend 1 hour eating, you can’t run a marathon
during that one time. This is the idea of the opportunity cost, that I
mention in this newsletter. The idea of min-maxing that I
mentioned in the podcast is related to this idea. Essentially it is
about living minimally in most avenues of life and just focusing on
a few key areas. This frees up a lot of time and mental energy that
would otherwise be spent on making uncritical decisions. You have
to decide what is most important to you, and ruthlessly replace
everything else. For example, some of you may know that I
compete in Combat Sports. However, having gone back to school
for one year, I no longer have a lot of time. Because of that I can no
longer train as intensely/regularly and am competing at a heavier
weight (so I don’t have to diet as much). You will have to make
similar sacrifices.
2. Rest a Lot.- No good comes from not resting. Make rest your
primary priority. That will allow you to truly benefit from what you
learn and stay consistent. Sleep, take breaks, and conserve your
energy. All things will save you.
3. Take it day by day- Instead of setting bigger goals like “50
Leetcode Questions in a month", set smaller daily goals (1-2 LC
questions a day). This makes adherence to your goals much easier
since your goals become much more tangible.

6
7

4. Take breaks to assess your situation- There is a lot of value in


occasionally stepping back and reevaluating your situation. Is what
you’re doing well-aligned with your objectives? Is there something
you can do to improve your process? Is there something that needs
to change, now that you have learned more? Maybe you notice that
you struggle with trees but ace Regexs. Making the appropriate
adjustment is a good call. I suggest assessing your learning so on
a weekly basis.
5. Cap your self-study to 1-2 hours a day- Don’t burn the midnight oil.
You need your energy and have other commitments. Doing too
much is as harmful as doing too little. 1-2 hours a day of deep
study is more than enough to progress your learning very quickly.
6. Analyze your progress obsessively- Make sure that you track your
performances. What gets measured gets improved. When you
struggle with a question, try to figure out what you struggled with.
Was it coding? Theoretical Knowledge? Speed? Edge cases?
Understanding terminology? Having a detailed analysis of your
learning journey allows you to grow at a rapid-fire pace.
7. Celebrate progress not milestones- It’s easy to get frustrated and
quit. Especially starting off, when progress isn’t always noticeable.
The antidote to this is in celebrating your small wins. Instead of
defining your success as ‘Solved LC problem’/ ‘Got promotion’
focus on progress-related markers like, ‘Was able to explain X
better than before’ or ‘Recognized a business case for an idea that I
had missed previously’. These will be better friends for your mental

7
8

health and consistency. Tracking your progress will help a lot with
this.

I will be doing more detailed posts on these points to go into more detail.
Stay tuned, for those.
Loved the post? Hate it? Want to talk to me about your crypto portfolio?
Get my predictions on the UCL or MMA PPVs? Want an in-depth analysis
of the best chocolate milk brands? Reach out to me by replying to this
email, in the comments, or using the links below.

Stay Woke,

Go kill all,

Devansh <3

Reach out to me on:

Instagram: https://www.instagram.com/iseethings404/
Message me on Twitter: https://twitter.com/Machine01776819
My LinkedIn: https://www.linkedin.com/in/devansh-devansh-516004168/

My content:

Read my articles: https://rb.gy/zn1aiu


My YouTube: https://rb.gy/88iwdd

8
9

Understanding the CAP theorem [Math


Mondays]

Life is all about tradeoffs,


This is also true in designing high-level systems. As an engineer/tech
manager, you will have to design systems that are scalable, robust, and
(most importantly) useful. A large part of this is in understanding your
problem domain and picking the avenues that you should maximize and
which metrics are not critical.
The CAP theorem is one way of framing the tradeoffs you would make. It
states that you can only guarantee 2 out of the 3 desirable traits you
would want in a distributed system- Consistency, Availability, and
Partition Tolerance.

Have you ever seen an advertisement for a landscaper, house painter, or


some other tradesperson that starts with the headline, “Cheap, Fast, and
Good: Pick Two”?

-A pretty good analogy by IBM

.In this post, we’re going to go over what these terms mean and why you
have to make a tradeoff. In a follow-up Sunday post, I will go into more
detail about the datasets you should know about to excel in your
interviews/system design work.

9
10

Remember that a distributed system is just a system with a lot of


different nodes performing tasks. Photo by Alina Grubnyak on Unsplash

Important Highlights

1. What is the CAP Theorem- As mentioned, the CAP theorem (or


Brewer's theorem after computer scientist Eric Brewer) states that
you can only guarantee 2 out of the 3 desirable traits you would
want in a distributed system- Consistency, Availability, and Partition
Tolerance.
2. What is Consistency in the CAP theorem- Every node in your
network will be updated with the most recent read/write at the

10
11

same time. This ensures that at any given moment, every node has
the same values.
3. What is Availability in the CAP theorem- Each read or write request
for a data item will either be processed successfully or will receive
a message that the operation cannot be completed (I like to liken it
to the idea of Atomicity in ACID). Every node must be able to
respond in a reasonable amount of time.
4. What is Partition Tolerance in the CAP theorem- Partitions occur
when due to a failure in the network responsible for connecting the
nodes of the system. The nodes are fragmented into different
partitions and the nodes in each partition can only communicate
with each other. Partition Tolerance guarantees that the system
keeps functioning when this happens.
5. Why we can only make 2 out of 3 guarantees in the CAP theorem-
In the case where you have single systems (no partitions can
occur), you can guarantee Consistency and Availability. Single-node
systems clearly can’t guarantee Fault Tolerance.
Let’s say that network partition failure happens, it must be decided
whether to do one of the following:
○ cancel the operation and thus decrease the availability but
ensure consistency
○ proceed with the operation and thus provide availability but
risk inconsistency.
6. Knowing which tradeoff to pick- Depending on your needs, these 3
metrics will have different importances. So how do you know which

11
12

guarantees to pick? I suggest thinking back to your end customer.


Which of these can they live without? Which guarantee is
absolutely essential? Your user journey will decide which guarantee
you sacrifice.

To those of you who want some fun visuals, the following video by
ByteByteGo is a good start. Check it out.

CAP Theorem Simplified | System Design Fundamentals

Stay Woke,

Go kill all,

Devansh <3

Reach out to me on:

Instagram: https://www.instagram.com/iseethings404/
Message me on Twitter: https://twitter.com/Machine01776819
My LinkedIn: https://www.linkedin.com/in/devansh-devansh-516004168/

My content:

Read my articles: https://rb.gy/zn1aiu


My YouTube: https://rb.gy/88iwdd

12
13

5 Easy Tips for Writing Cleaner Code


[Technique Tuesdays]

Some of the highest ROI techniques that

Clean Code,
It’s one of those terms that is thrown around a lot. Obviously, you want to
write code that is pristine, but what does that actually mean? This can be
a hard question to answer because the people interacting with your code
are often not the end users. This means that code quality is not always
correlated with the performance of the code, which makes the concept
of code cleanness very abstract. You can’t really write tests to check for
code cleanness the same way you can for functionality.

13
14

Photo by Ilya Pavlov on Unsplash

With that being said, writing clean code is exceptionally important. In


Microsoft’s research into what makes great software engineers, the
ability to write high-quality code ranked very highly. If you’re angling for
promotions (especially in big tech companies), the feedback your
supervisors give in their code reviews will be key. Thus writing amazing
clean code is a must.

In this article/post, I will be giving you 5 easy tricks to immediately start


writing clean code. You can implement these techniques right away to

14
15

start writing code that is both functional and cleaner than Luka Modric’s
dribbling.

Important Highlights

1. What is Clean Code- The way that I see it, clean code is code
written for other developers. Clean code is code written in a way
that other developers (even those with minimal context) have an
easy time reading through the code base and extracting the key
ideas from it.
2. Technique 1, 𝗣𝘂𝗿𝗲 𝗙𝘂𝗻𝗰𝘁𝗶𝗼𝗻𝘀- A pure function is a function that
always returns the same output, given the same input(s). It doesn't
depend on any external variable apart from the inputs provided, nor
it affects/changes any outside variable. Having pure functions
makes it a lot easier to test it.

3. Technique 𝟮. 𝗡𝗮𝗺𝗲𝗱 𝗣𝗮𝗿𝗮𝗺𝗲𝘁𝗲𝗿𝘀 - When using functions, we often


use positional parameters which have to be provided as they're declared
with the function declaration. It is hard to see from the function-calling
statement which parameter corresponds to which argument of the
function.
window.addNewControl("Title", 20, 50, 100, 50, true) #instead of this

window.addNewControl(title="Title",

15
16

xPosition=20,
yPosition=50,
width=100,
height=50,
drawingNow=True) #do this
This can save your fellow developers a lot of mental energy. Not
every language has this feature. One way to get around it is to use
Objects for params, where the objects contain the params. Another
easy way to get around this is the next technique.

4. Technique 3. Meaningful 𝘃𝗮𝗿𝗶𝗮𝗯𝗹𝗲 𝗻𝗮𝗺𝗲𝘀- If we create variables like


"p", "t", and "c" without having a context, it is really hard to read, trace and
maintain such code. I talked about this in the post on writing better
comments for your code. You can replace a lot of unneeded comments
just by using meaningful variable names.

1. Technique 4. 𝗔𝘃𝗼𝗶𝗱 𝗛𝗮𝗿𝗱-𝗰𝗼𝗱𝗲𝗱 𝘃𝗮𝗹𝘂𝗲𝘀- It is really hard for


someone reading the code to understand what the hard-coded
value means. Especially when it's used at different places in the
code. Large codebases have a lot of moving parts and keeping
track of hard-coded values can get taxing. Use properly named
Enums, const, or object mappings to represent constant values.

Technique 5. Use Default Values- A seriously overlooked technique is


the utilization of default values in your code. You will see many lines of

16
17

code dedicated to validating inputs. This increases code complexity,


drops readability, and leads to more dev time spent in understanding the
code as opposed to problem-solving. Enforcing default values is a great
way to get around it.
function(val1, val2 ..){ #notice all the lines spent in validation
check for val 1
check for val 2...
}

function(val1=default1,val2= default2 ..){


get directly into using the values
2. }

Using these techniques will allow you to easily make your code much
cleaner in an effortless manner. Do you have any techniques that you
really like to use? Let me know in the comments/by reaching out to me.

Stay Woke,

Go kill all,

Devansh <3

Reach out to me on:

Instagram: https://www.instagram.com/iseethings404/

17
18

Message me on Twitter: https://twitter.com/Machine01776819


My LinkedIn: https://www.linkedin.com/in/devansh-devansh-516004168/

My content:

Read my articles: https://rb.gy/zn1aiu


My YouTube: https://rb.gy/88iwdd

18
19

Problem 71: Permutation in String


[Microsoft]
Hashing, Strings, and a lot of love

To me following is a particularly interesting question,


Why is interesting you ask? I’ll answer it tomorrow. Going over it here
would spoil the answer. For now, just take my word for it. After all, have I
ever lied it you?
What is this question you ask?

This problem can be found as problem 567. Permutation in String

Problem

Given two strings s1 and s2, return true if s2 contains a permutation of


s1, or false otherwise.

19
20

In other words, return true if one of s1's permutations is the substring


of s2.
Example 1:
Input: s1 = "ab", s2 = "eidbaooo"
Output: true
Explanation: s2 contains one permutation of s1 ("ba").

Example 2:
Input: s1 = "ab", s2 = "eidboaoo"
Output: false

Constraints:
● 1 <= s1.length, s2.length <= 104
● s1 and s2 consist of lowercase English letters.

You can test your solution here

Stay Woke,

Go kill all,

Devansh <3

Reach out to me on:

Instagram: https://www.instagram.com/iseethings404/

20
21

Message me on Twitter: https://twitter.com/Machine01776819


My LinkedIn:
https://www.linkedin.com/in/devansh-devansh-516004168/

My content:

Read my Machine Learning breakdown articles: https://rb.gy/zn1aiu

My YouTube: https://rb.gy/88iwdd

21
22

[Solution]Problem 71: Permutation in String


[Microsoft]
Hashing, Strings, and a lot of love
I’m going to start with an announcement,
The newsletter giveaway has finished. Over 300 people will get this
newsletter for free. To those that filled out the form, you will now have
access to all the paid content in my newsletter, for the next year, no
strings attached. This should help those of you struggling with the
economic uncertainty of today. Use all the knowledge already shared
that I will continue to share to boost your career.
Getting back to today’s question. How did you do on this question? Did
you get the solution? Let me know by replying to this email.

This problem can be found as problem 567. Permutation in String

Problem

22
23

Given two strings s1 and s2, return true if s2 contains a permutation of


s1, or false otherwise.
In other words, return true if one of s1's permutations is the substring of
s2.
Example 1:
Input: s1 = "ab", s2 = "eidbaooo"
Output: true
Explanation: s2 contains one permutation of s1 ("ba").

Example 2:
Input: s1 = "ab", s2 = "eidboaoo"
Output: false

Constraints:
● 1 <= s1.length, s2.length <= 104
● s1 and s2 consist of lowercase English letters.

You can test your solution here

Step 1: Finding the Simple Edge Cases


In terms of wording and what it’s asking, this question is pretty straightforward. The tricky part is
in the implementation. In such cases, one of the easiest first steps is to start discovering the

23
24

algorithm is to simply start by attacking simple edge cases. This is a nice way to simplify your
problem and discover some underlying hints about the structure of the problem. It allows you to
hit upon the Communication and Problem-Solving pillars of cracking interviews in one easy
sweep.

This is the 5 Pillar Approach that this newsletter uses to maximize your chances of success.
In our case, there is a clear edge case. Since we are checking for s1 being a part of s2, we
know that we can return false if s1 is longer than s2.
if len(s1)>len(s2): return False
This is a quick way to buy yourself some time and gain a few brownie points from the
interviewer. So where do we go from here?
Here is where some previous knowledge can be helpful. Anytime we are looking for
substrings(in our case s1) within a larger string (s2), the sliding window approach is one of your
best friends. We’ve solved a lot of problems using that, so if you’re looking for practice with this
approach, here are a few older posts on it.

Step 2: Sliding Window

24
25

The sliding window approach is pretty simple. Use two pointers to define an interval on a
string/list, and check for your desired pattern/property in that interval. If you don’t find the
pattern, move your window across to form a new interval.

This approach is great for a simple reason, it’s cheap. Sliding window problems can usually
done in O(n) time. You will see this pattern pop up quite a bit, especially for questions involving
anagrams or strings.
Our sliding window has one major simplification- the length of the window is fixed. We just
need to slide our window across, comparing whether our values match. How do we do this?
The simplest approach would be to generate every permutation (anagram) of s1 and check
whether the current window of s2 has them. This is extremely costly and presenting this as the
final solution will get you kicked out of the interview (and most probably blacklisted from the
company). Fortunately, there is a better approach, one that’s much easier to code and has lower
complexity. It takes advantage of the sliding nature of the sliding window approach. What is it?
Let’s get into it.

Step 3: An efficient comparison


To understand why the idea I’m going to show is better, let’s first understand why the idea of
comparing permutations is bad. This comes down to something you should avoid at all costs,
repeated work.
Take our current, brute-force approach. When you move on from one window to the next, you
essentially discard everything you learned in the previous window and recreate all the
permutations. This is completely unnecessary. Let’s say our window starts with the interval [0,4].
We find no matches, here so we go to the window [1,5]. Notice that most of our characters stay
the same. When compared to our previous window, we only need to replace the character at [0]
and add the char at [5]. This is the magic of the sliding window approach.

25
26

What does this mean? All we have to do is build the window once. After that, it’s just a matter of
replacing the appropriate characters.
I can see the tube light going off in your mind. With this insight, you should be able to see 2
things-
Our windows will be stored hashmaps/dicts. We can leverage their O(1) time for lookup and
insertion to quickly replace characters. Our sliding window character adjustments are made with
the following 2 lines-
h2[s2[l]] -= 1
1. h2[s2[r]] = h2.get(s2[r], 0) + 1
2. Our comparison will just be checking if the two dicts are equal. High-level languages
have this comparison feature built-in.

With that out of the way, the code should become relatively straightforward.

Step 4: Coding It Up
Here is the code for this solution.
from collections import Counter
class Solution:
def checkInclusion(self, s1: str, s2: str) -> bool:
if len(s1)>len(s2): return False

l, r = 0, len(s1)
h1 = Counter(s1)
h2 = Counter(s2[:len(s1)])
#Counter just returns the dict with the no. of occurences in a string

while r < len(s2):


if h1 == h2: return True
h2[s2[l]] -= 1
h2[s2[r]] = h2.get(s2[r], 0) + 1
r += 1
l += 1

26
27

return h1 == h2

Time Complexity- O(len(s2) )

Space Complexity- O(len(s1))

Loved the solution? Hate it? Want to talk to me about your crypto portfolio? Get my predictions
on the UCL or MMA PPVs? Want an in-depth analysis of the best chocolate milk brands? Reach
out to me by replying to this email, in the comments, or using the links below.

Stay Woke,

Go kill all,

Devansh <3

Reach out to me on:


Instagram: https://www.instagram.com/iseethings404/
Message me on Twitter: https://twitter.com/Machine01776819
My LinkedIn: https://www.linkedin.com/in/devansh-devansh-516004168/

My content:
Read my articles: https://rb.gy/zn1aiu

My YouTube: https://rb.gy/88iwdd

27
28

Salesforce CEO profits from laying off 7000+


people [Finance Fridays]

How misaligned incentives create misfiring systems


What a crazy week,
I know the title is about Salesforce, but there is another crazy event that
happened this week that I have to mention. 2023 is off to an exciting
start.
Turns out that JP Morgan got scammed for 175 Million USD. They
bought a startup, only to learn more that they had created millions of
fake customers. I created a post about this situation here. I’ve been
writing about how factors such as a company’s valuation, how much
money they raised, and which investor is backing the firm are
meaningless. This is another example of that. To learn more about why
Smart Money consistently invests in startups that end up being just
hype, overvalued, or straight-up frauds, read this article below.

For a more thorough understanding of the weird finances of the Tech


Industry, check out the articles in the reading list. Find them here.
Back to the main point of today’s post, let’s get back to the Salesforce
layoffs. To those of you that missed it, tech giant Salesforce is laying off
about 10% of its workforce, more than 7,350 employees. This news has
been met with a lot of movement in the stock price of Salesforce. And

28
29

not in the way you’d expect. The news of these layoffs led to a notable
increase in stock prices. Confused why this happened? And what you
can do to protect yourself? Continue to read on.

Important Highlights

1. Why these layoffs happened- As I’ve covered before, our economy


is cyclical. It goes through periods of growth (booms) and then
contractions (busts). Recessions and layoffs are a feature, not a
bug. This cycle is caused by the presence of debt in an economy.
Tech is particularly susceptible to the cycle b/c tech startups rely
heavily on debt and funding to grow. When times are good, this
leads to great results. When times are bad, companies go
bankrupt. For more information on the boom and bust cycle, read
the post here.

29
30

2. The Public Company Trap- Public Companies refer to companies


that are traded on the stock exchange, for everyone. The shares of
these companies have a much larger pool of buyers, thus they have
higher valuations. However, they are also scrutinized much more
heavily and have lesser leeway in how they operate. As opposed to
privately traded companies, publicly traded companies have a
much stronger pressure to please their investors. Pleasing
investors is one of the biggest reasons for mass layoffs.
3. Why Layoffs are good for the Stock- So why did the Salesforce
stock price go up, during layoffs? In the long run, layoffs mean that
Salesforce will not be able to expand as quickly. However, in the
short term, layoffs represent a reduction in operational costs.
Investors respond positively to this.
4. How the CEO of Salesforce benefits from layoffs- CEOs and
upper-level management are compensated mainly with stock
options. The layoffs increase the amount of money they gain.
Therefore, even when the CEO claims that he takes all the
responsibility, he doesn’t face any of the consequences.
5. What you should do- Noone can protect themselves from layoffs
fully. However, there are some ways you can set yourself to be
better protected. Generally speaking, private companies will be less
susceptible to investor whims. Similarly, when talking to a firm,
their profitability and job security will be correlated strongly. This
might lead to lower compensation, but as the maxim states—> no

30
31

pain, no gain. If your goal is job security, aim for places with low
churn and more steady revenues.

If you want to learn more, YouTuber Josh Fluke made an in-depth video
about the layoffs, how the CEO has offloaded his stocks, and a lot more.
His channel is great because it often exposes the hypocrisy and double
standards that some companies impose on their employees. I would
suggest watching it, to help you identify red flags in your own work
culture.

SALESFORCE FIRES 7,000+ WORKERS, CEO MAKES BANK | #…

I created Technology Made Simple using new techniques discovered through tutoring multiple
people in top tech firms. The newsletter is designed to help you succeed, saving you from hours
wasted on mediocre resources or on the Leetcode grind. Easily find your needs met in one
place. I have a 100% satisfaction policy, so you can try it out at no risk to you. Use the button
below to get 20% off for up to a whole year. Using this discount will drop the prices-
800 INR (10 USD) → 533 INR (8 USD) per Month
8000 INR (100 USD) → 6400INR (80 USD) per year
Get 20% off for 1 year
In the comments below, share what topic you want to focus on. I’d be interested in learning and
will cover them. To learn more about the newsletter, check our detailed About Page + FAQs
If you liked this post, make sure you fill out this survey. It’s anonymous and will take 2 minutes of
your time. It will help me understand you better, allowing for better content.
https://forms.gle/XfTXSjnC8W2wR9qT9
If you like my writing, I would really appreciate an anonymous testimonial. You can drop
it here.

Stay Woke,

31
32

Go kill all,

Devansh <3

Reach out to me on:


Instagram: https://www.instagram.com/iseethings404/
Message me on Twitter: https://twitter.com/Machine01776819
My LinkedIn: https://www.linkedin.com/in/devansh-devansh-516004168/

My content:
Read my articles: https://rb.gy/zn1aiu
My YouTube: https://rb.gy/88iwdd

32
33

How to be an amazing Junior


Developer/Intern [StoryTime Saturdays]
How can you stand out during your internship or early career to get ahead?

How can you turn your internship into a return offer?


What can you do to quickly move from a junior developer role into a more
senior position?
These are questions that a lot of you have no doubt asked. Standing out
in your early career stages can exponentially speed up the trajectory of
your growth, both personally and professionally. Making a strong
impression will ensure that you get better opportunities at work, save
you from a lot of wasted hours, and be one of your strongest layers of
defense against layoffs. For this article, I talked to various tech leaders
and managers about the actions that help junior devs/interns stand out
to them. This article will go over the recurring motifs that I saw in our
conversations.
Whether you’re an intern looking to get that return offer, a junior dev
looking to shoot through the career ladder, or a senior dev/manager
looking to improve the productivity of your junior devs, this is not an
article you want to miss.

33
34

If this newsletter has helped you, I would appreciate a testimonial. Helps


me grow my brand and secure partnerships. You can drop it here.

Key Points Covered

1. Communicate the Why- Most juniors work on specific


features/implementations. The significance of their
work/challenges can be lost on more senior people, who don’t have
the bandwidth to get into the details of your work. When presenting
your work, always communicate why you worked on this and what
your contribution will add.
2. Your Biggest Hurdle is your supervisor’s time-Most supervisors
have a lot on their plate, not excluding the people that report to
them. Thus they will not be able to give your a lot of time and
energy. Accounting for this and adjusting your behavior accordingly
will be a great way to show ownership and the ability to work
independently.
3. Consistently Ping People- One great way to remain in people’s
minds is to constantly share things with them. Make it a point to
have a lot of sources of information, and share what you come
across with your supervisors/teammates. These can be papers you
read, videos you watched, interesting news you came across, or
even a particularly excellent newsletter/blog post (wink wink).
4. Learn to say no- People will give you as much work as you will take.
Especially at Junior Levels, there can be a large variance in the

34
35

possible impact of the different work thrown at you. Learn to


critically evaluate whether a task is worth doing, and do only the
tasks that will be important. This is where understanding your end
customers and viewing tech as an industry are critical.
5. Build a Time Machine- Your colleagues don’t live in your mind.
They don’t know all the ways your current work is relevant to the
orgs future goals. Create documentation of your work and how this
project can be taken forward. This way, if your project gets more
investment and your org decides to pursue it, you know who they
will call. You also have an easy store of all your contributions you
can point to.

Want more details? Let’s get right into it.

35
36

Photo by AltumCode on Unsplash

Communicate the Why

Too many inexperienced developers spend their time communicating the


what of their work/progress (“I made hyperlinks more colorful”) and not
the why (“Saw that people on our website weren’t able to distinguish
between the links and are text, so I added color”). This is because we
implicitly assume that people know what we know. We just assume that

36
37

people will see things the same way we do. Nothing could be further
from the truth.
Keep in mind everyone you’re working with is also facing their own
unique challenges and circumstances. They will put the minimum
possible amount of energy into what you’re doing, just because they
have to conserve their attention for their own work. How many times
have you zoned out during meetings when someone else is presenting
their work? This is doubly true for more senior people, who often tend to
ignore the presentations by their juniors b/c most of that work is too
low-level/focused. Chances are, your supervisor doesn’t really care that
you tried an ARIMA instead of an LSTM for your time series forecasting
task.
I have 6 interns reporting to me, and I couldn’t give you details on what
they do.
-Data Manager, Consulting Company
This is a problem if you care about good performance reviews. These are
the people who will give you your offer/promotion. So what do you do
instead? If you got great acting skills, buy a fake mustache. Then french
revolution your managers, take their spot and pretend to be them for the
rest of your life (this will work regardless of whether your manager has a
mustache or not. Fake mustaches have magic in them). But what about
those who skipped out on acting class? Don’t worry, I have something for
you as well.
For every action you take, justify how that action is expected to impact
the business case. Instead of just saying you added regularization to the

37
38

model, talk about how the current data models were not generalizing
well to new clients, increasing operational overhead (basic business bro
jargon is a game changer. Show up to Finance Fridays to speak Finance
Bro). Speaking in terms of business impact is going to make everyone’s
ears perk up. It can also lead to you getting better input since people can
throw in their own 2 cents. This step is relatively simple to implement
and will lead to amazing outcomes. Try it and thank me later. I did a
more in-depth post on how to crush daily standups here, so check it out
if you’re interested.
Now moving on to a mindset shift you have to make.

Your Biggest Hurdle is your supervisor’s time

Your supervisor is probably really busy. Thus they really value people
who can work independently and will take initiative on projects. Start
doing this. A lot of interns/juniors make the mistake of waiting for
approval for every task they embark on. If you think something is worth
doing, just do it. Start working on the improvement you think is
worthwhile. If your manager/colleagues don’t like it, they will let you
know in the meeting/async channels. I’m not asking you to ignore the
procedures for shipping to production and just push whatever features
you want out there. However, too many juniors keep waiting around for
their supervisors to assign work to them. Flip this approach on its head.
Do what you want, as long as other people aren’t telling you to stop. Even
if you make a mistake, a good supervisor will appreciate your initiative.

38
39

The only caveat (as I’ve said before) is to make sure you’re always
communicating your work. This gives people opportunities to chip in and
offer course correction before you do something catastrophic. And
obviously, don’t push your work into production without the appropriate
checks.

It was a pleasure working with Devansh. He repeatedly demonstrated


that he can take challenging data science tasks, apply research, and
implement sound but novel enhancements resulting effective solutions.
Combined with outstanding communication skills and minimal need for
supervision he became a great part of the team.

- Notice how my manager recommendation stresses my independence


and communication. This recommendation is on my LinkedIn profile.

Don’t overlook the power of constant communication. Remember people


will never know the true amount of work you put into something. The
problem with abstract fields like software is that work and productivity
are very hard to define. Constantly sharing updates, interesting
information you came across, and thoughts on your work will help you
gain more attention and stand out in a positive way.
Before moving on to the next section, let me quickly summarize some of
the major benefits of constantly communicating-
1. Helps people remember who you are and what you’re working on.

39
40

2. By constantly sharing updates, your colleagues are more likely to


see you as someone with information. You can become their go-to.
Top-of-the-mind recall is a powerful thing.
3. If you share your thoughts/rationale, and people don’t push back,
then the responsibility is distributed. Thus, if something goes
wrong, it won’t solely be your fault.
4. You contribute to the knowledge of the team.
5. Makes it possible to receive better feedback, improving the quality
of your work.
6. Brings people along for the work. If you’re constantly sharing
papers/writeups, then it’s very hard for people to claim that you’re
not doing much.

There are many others (such as communication improving the clarity of


your thought). I’ll do a dedicated piece on communication soon. For now
let’s move on the most challenging, but important component.

Say No To Work

In my post about how to easily integrate self-study into your life, I talked
about the importance of picking your battles and not wasting your
energy. The same principle applies here. There will always be unrealistic
expectations that others place on you wrt what they expect. Your
manager will give you large unrealistic projects. There will always be

40
41

more bugs to fix, code to optimize, and features to implement. It’s not
your job to do all of it.
Instead, you need to be discerning. When given a task, evaluate whether
it is feasible and worthwhile. Is there a more pressing task you can do?
Can the same outcomes be achieved with a simpler method? Are the
timelines realistic? Remember, your supervisor doesn’t have their boots
on the ground, you do. So if you believe that something is not the right
call, let them know. Most good supervisors will be happy to listen to you
and either provide you with guidance on how to accomplish tasks or
revise their expectations. Either is a win. Provided that you are able to
communicate properly, there is nothing wrong with providing alternative
ideas. The following format works well if you want to refuse the work
given to you-
1. Point out what goal the proposed task is supposed to accomplish.
This shows that you understand the proposed task.
2. Talk about why you think the task might not be best (technical
challenges/scale/time etc).
3. Present your alternative.
4. If your alternative solves a different problem, then talk about why
solving that problem makes more sense given current
circumstances.

This format allows for open and constructive discussion. Steal it. If you
have any proposed changes, let me know in the comments/by replying to
this email/messaging me through my links.

41
42

This can be incredibly scary at first, but it is worthwhile. Learning to


effectively set your boundaries and negotiate your work is crucial for not
getting burned out later in life.
Now for the final adjustment, you should make to stand out. This will be
easy, provided that you do everything else.

Pull Out the Crystal Ball

As you’re working on a task, maintain detailed documentation on what


you’ve done, how your contributions helped larger KPIs, and how your
work can be extended into the future. This can include not just your
successes, but also your failures (tried model but it didn’t work). Anyone
looking through it should have a very concise idea of what you did and
what it accomplished.
This is one of the highest ROI moves to help you get ahead in your
career. Whether it’s for performance reviews or the end of your internship
period, presenting this to your manager is a way to boost your chances
of earning your goals. If one of the things you work on ends up becoming
a more important project, then your documentation would be important
for version 0 of the project. It will also be a great reference manual if
you’re preparing for interviews. Going over what you did and the
challenges etc will make for great talking points (just be sure not give
away company IP).
If you’re looking for guides on how to create good documentation, refer
to this post.

42
43

Loved the post? Hate it? Want to talk to me about your crypto portfolio?
Get my predictions on the UCL or MMA PPVs? Want an in-depth analysis
of the best chocolate milk brands? Reach out to me by replying to this
email, in the comments, or using the links below.

Stay Woke,

Go kill all,

Devansh <3

Reach out to me on:

Instagram: https://www.instagram.com/iseethings404/
Message me on Twitter: https://twitter.com/Machine01776819
My LinkedIn: https://www.linkedin.com/in/devansh-devansh-516004168/

My content:

Read my articles: https://rb.gy/zn1aiu

My YouTube: https://rb.gy/88iwdd

43
44

Strategies for Replication in Distributed


Databases [System Design Sundays]
And the different strategies you can apply to

Let’s talk about replication in distributed databases, all the amazing


benefits it brings, and how you can handle it-

Key Highlights

1. What is Replication- Replication is where you keep a copy of your


data on multiple different machines. These machines are
connected via a network, so they’re all accessible to your backend
server(s). Thus instead of a centralized DB, you are now using a
distributed database, spread over multiple machines.
2. Benefits of replication on distributed systems- Replication has the
following major benefits-
○ Reduce latency -Take a global app like YouTube. You want
Indian YT users querying a machine close to them. Same for
a Brazilian user. Thus having 2 different DBs makes sense.
This is similar to why you would use a Content Delivery
Network (CDN), a new trend that we covered here.
○ Increase Availability+Security- Having data present on
multiple machines means that if one DB gets corrupted/goes

44
45

down, others can be used w/o any issues. This helps both
Availability (which we covered this Monday) and Security (for
authentication).
○ Increase Read Throughput - Many systems are extremely
read-heavy (way more reads than writes). Take Substack for
example. There are more readers on the platform than
writers. Thus there are many more read operations. than write
operations. Having multiple DBs can help spread the load of
multiple reads across multiple machines, increasing read
throughput.
3. Handling changes to replicated data- When you get a write request
that modifies your database, how do you make sure that all the
replicas reflect this write request? How do you stop replicas that
haven’t updated from responding with stale data to read requests?
You have 3 popular options-
○ Single Leader Architecture: In this architecture, one server
accepts client writes and replicas pull data from it. This is the
most popular and traditional way. It’s the synchronous
technique, but it’s also quite rigid.
○ Multi Leader Architecture: In this architecture, multiple
servers can accept writes and serve as a model for replicas.
To avoid delay, copies should be spread out and leaders
should be near all of them.
○ No Leader Architecture: Every server in this architecture can
receive writes and function as a replica model. While it

45
46

provides maximum flexibility, it makes synchronization


difficult.
4. Active vs Passive Replication- Another way of viewing the data
replication challenge is to differentiate b/w active and passive
replication. In active replication, all replicas receive and process the
same set of client requests. This ensures consistency but adds a
lot of overhead to your system. In contrast to this, in passive
replication, all client requests are handled by a primary server.
Other replicas then adjust to the primary. This requires lesser
resources, but you need to make sure to constantly check for the
health of the primary server.

5.
6. Image Source

46
47

Almost all distributed databases use one of the three approaches and
they all have their pros and cons. We will do a more in-depth look into
these soon. In the meanwhile, if you want to learn more check out the
following resources. Much of the research for this write-up was inspired
by the amazing publication Quastor. I have been recommending their
publication for some time now. You can read their work here. I also
referred to Data Replication in Distributed Systems: The Best Guide 101,
an amazing article you can find here.

I created Technology Made Simple using new techniques discovered


through tutoring multiple people in top tech firms. The newsletter is
designed to help you succeed, saving you from hours wasted on
mediocre resources or on the Leetcode grind. Easily find your needs met
in one place. I have a 100% satisfaction policy, so you can try it out at no
risk to you. Use the button below to get 20% off for up to a whole year.
Using this discount will drop the prices-
800 INR (10 USD) → 533 INR (8 USD) per Month
8000 INR (100 USD) → 6400INR (80 USD) per year
Get 20% off for 1 year

47
48

In the comments below, share what topic you want to focus on. I’d be
interested in learning and will cover them. To learn more about the
newsletter, check our detailed About Page + FAQs
If you liked this post, make sure you fill out this survey. It’s anonymous
and will take 2 minutes of your time. It will help me understand you
better, allowing for better content.
https://forms.gle/XfTXSjnC8W2wR9qT9
If you like my writing, I would really appreciate an anonymous
testimonial. You can drop it here.

Stay Woke,

Go kill all,

Devansh <3

Reach out to me on:

Instagram: https://www.instagram.com/iseethings404/
Message me on Twitter: https://twitter.com/Machine01776819
My LinkedIn: https://www.linkedin.com/in/devansh-devansh-516004168/

My content:

Read my articles: https://rb.gy/zn1aiu

My YouTube: https://rb.gy/88iwdd

48
49

Solving f'(x)= f^(-1)(x) [the inverse of f(x)]


[Math Mondays]
An illustration of a very powerful technique in problem solving. Helpful in both
Math and Software.
I’m about to share an amazing video with you.
The video solves an interesting Math Problem-
f'(x)= f(^-1) (x)
If you need a refresher on the symbols, the question wants us to find a
function where the function’s derivative is equal to its inverse. If these
terms don’t sound familiar to you, go back to my Math for Computer
Science post and study the concepts there. Why am I sharing this
problem with you?
The solution to this problem utilizes the same patterns, principles, and
problem-solving techniques that you will find useful in competitive

49
50

programming, Leetcode Interviews, and software engineering skills. As


I’ve talked about repeatedly in this newsletter/my content- Math and
Coding work very similar neural pathways. This is why people with a
Math Background have an easier time coding (and why most job
postings say Computer Science OR Math in their education
requirements). Working on Math Problems will directly improve your
Coding Skills (especially for Leetcode-style interviews). If you want to
improve in Interviews or Coding, don’t miss this.

Before you proceed, try to solve the problem yourself. This will really
strain your mental muscles. Once you’re done/have given up, read on.

The Important Steps in this Video


As you watch the video, I want you to notice the following things-
1. Solve a Warm-Up Problem First- Micheal starts the problem by
finding a warm-up problem, which is significantly easier than the
main problem. Anyone who has read many of the solutions here
should recognize this step right away. Just to drill home effective
this technique is, take a look at the words of one of the people who

50
51

worked with me in the past. This student was terrified of Leetcode


Interviews. Now they are leading a team at a Tech Giant.

2.
3. Quick Problem Solving relies on pattern Matching- The way
Micheal quickly runs through options might seem magic to you.
But it is something that all of you do very well- pattern matching. If
you’re struggling with a certain Data Structure or Algorithm- start
exposing yourself to a lot of questions about that DS/A.
Specifically, stick to the Easy Questions, which will let you build
pattern-matching skills. As I’ve covered here, Easy Questions are the
most important type of question that you should be working with for
learning an idea.
4. Attack a Problem from multiple angles- Notice how many different
ideas are pulled in to create the final solution. It’s not enough to

51
52

master one idea in isolation. You’re much better off seeing how
different ideas interact with each other. This will build much deeper
intimacy with these ideas.
5. Complex Solutions can have simple building blocks- None of the
ideas used in the articles are really that high-level. The concepts
needed to solve it are mostly high-school level. This question isn’t
hard because you need to know a lot. This question is hard
because you need to use what you know. In fact, many higher-level
math/computer science solutions are very similar to this. This is
why there is so much value in learning the basics. They will show
up everywhere.

With all that out of the way, take a look at the video. How did you do? Let
me know by replying to this email/post/using my social media links to
reach out to me.
A very interesting differential equation.
I created Technology Made Simple using new techniques discovered
through tutoring multiple people in top tech firms. The newsletter is
designed to help you succeed, saving you from hours wasted on
mediocre resources or on the Leetcode grind. Easily find your needs met
in one place. I have a 100% satisfaction policy, so you can try it out at no
risk to you. Use the button below to get 20% off for up to a whole year.
Using this discount will drop the prices-
800 INR (10 USD) → 533 INR (8 USD) per Month

52
53

8000 INR (100 USD) → 6400INR (80 USD) per year


Get 20% off for 1 year
If you like my writing, I would really appreciate an anonymous
testimonial. You can drop it here.
In the comments below, share what topic you want to focus on. I’d be
interested in learning and will cover them. To learn more about the
newsletter, check our detailed About Page + FAQs
If you liked this post, make sure you fill out this survey. It’s anonymous
and will take 2 minutes of your time. It will help me understand you
better, allowing for better content.
https://forms.gle/XfTXSjnC8W2wR9qT9

Stay Woke,

Go kill all,

Devansh <3

Reach out to me on:


Instagram: https://www.instagram.com/iseethings404/
Message me on Twitter: https://twitter.com/Machine01776819
My LinkedIn: https://www.linkedin.com/in/devansh-devansh-516004168/

My content:
Read my articles: https://rb.gy/zn1aiu

53
54

How to Stress Test your Systems [Technique


Tuesdays]

Some simple techniques to make sure your systems are much better.
I talk often about robust systems,
But how do you actually build systems that are robust? How can you
create software solutions that are robust? How can you decide what
makes a system robust, given a particular context? What is the
acceptable tradeoff between the simplicity of systems and their
robustness? These are all complex questions, ones that you will be paid
a lot of money to answer. But to get there, you need to answer a much
simpler question first.
What can you do to test whether a software solution is actually robust?
Take it live, and see how quickly bug reports pile in? That’s an option.
However, for those of you that are not brave in to try this out, here are a
few ways you can make test for a system for robustness.

54
55

Photo by Kelly Sikkema on Unsplash

55
56

How to check if your Code is Robust


1. Automated Zombies- Create a few automated accounts, which just
move around your system randomly. They try to input values, do
various actions, etc. Let them do as they like. These zombies will
keep traversing your system, checking various functionality. If you
want to be very thorough, you can program a few of them to be
erratic, sometimes inputting numbers where you should have
strings, etc. This will help you ensure that your system works the
way it should, and does not allow for unintended actions. You’d be
shocked at how many times your systems are not equipped to deal
with extremely random behavior.
2. Pay the Bangladeshis- Bangladesh is a nation notorious for click
farms (other nations like China and India have click farms too, but
Bangladesh just got a cool documentary on it). To those of you that
don’t know, click farms refer to places where groups of users are
paid to click buttons. Their end goal is to artificially increase
engagement on platforms. However, you can also use them to get
testers en-masse. These people will behave more human-like than
your bots, giving you insight into what components might need
reinforcement and which parts of your system are not attracting
attention.
3. Break components of your system- How does your system do
when you suddenly destroy key parts of your system? This might
seem weird, but this will happen more than you’d think. For

56
57

example, most of you type code on a standard computer, with


English as its language. What happens if you input another language
or another script entirely? Try it out. You will be surprised how many
big Tech products break down when you use another language. Or
what happens when you shut down an entire server? Last year, we
covered Chaos Engineering here. This is a favorite stress-testing
philosophy of Netflix-
We have created Chaos Monkey, a program that randomly chooses a
server and disables it during its usual hours of activity. Some will
find that crazy, but we could not depend on the random occurrence
of an event to test our behavior in the face of the very consequences
of this event.
-Read more about Chaos Engineering
4. Change your Mindset- Understand that your system will never truly
be robust. Chasing that is a foolish quest. However, this doesn’t
mean you don’t pursue your robustness goal. It means that you
focus. There will be avenues where robustness is more and less
important (you want robust payment protocols, and don’t care
about a robust UI). Remember you have limited time, developer
energy, and money (if you have unlimited money, send some over
this way. For charity reasons of course). Pick your battles and
focus on the key avenues. Not everything needs equal energy. Way
too many people chase straight 7s, instead of picking a few 10s
and a few 3s.

57
58

A lot of robustness testing will be determined by the context of your


solution. This is where domain knowledge comes in key. Keep updated
on the best practices and debates in your field, because you will always
pick up something interesting. Don’t forget, knowledge is the leverage
that you can use to propel yourself.

Some of the nice things y’all have said. If you’d like to be a pal, drop me a
testimonial here
I created Technology Made Simple using new techniques discovered
through tutoring multiple people in top tech firms. The newsletter is
designed to help you succeed, saving you from hours wasted on
mediocre resources or on the Leetcode grind. Easily find your needs met
in one place. I have a 100% satisfaction policy, so you can try it out at no
risk to you. Use the button below to get 20% off for up to a whole year.
Using this discount will drop the prices-
800 INR (10 USD) → 533 INR (8 USD) per Month
8000 INR (100 USD) → 6400INR (80 USD) per year
Get 20% off for 1 year
If you like my writing, I would really appreciate an anonymous
testimonial. You can drop it here.

58
59

In the comments below, share what topic you want to focus on. I’d be
interested in learning and will cover them. To learn more about the
newsletter, check our detailed About Page + FAQs
If you liked this post, make sure you fill out this survey. It’s anonymous
and will take 2 minutes of your time. It will help me understand you
better, allowing for better content.
https://forms.gle/XfTXSjnC8W2wR9qT9

Stay Woke,

Go kill all,

Devansh <3

Reach out to me on:


Instagram: https://www.instagram.com/iseethings404/
Message me on Twitter: https://twitter.com/Machine01776819
My LinkedIn: https://www.linkedin.com/in/devansh-devansh-516004168/

My content:
Read my articles: https://rb.gy/zn1aiu

My YouTube: https://rb.gy/88iwdd

59
60

Microsoft to integrate Open AI products


[Finance Fridays]
How does this change the landscape of Tech? Could this their way of
establishing their dominance in the Big Tech War?
By now I’m sure most of have heard the news,
Microsoft will be integrating OpenAI products into its services. This has
a lot of investors and financial experts buzzing. Can Microsoft finally
establish its dominance in the Big Tech War, and carve out a lot of
respect in the AI space? Meta and Google have really dominated the
recent headlines in Machine Learning. Could OpenAI be the secret
weapon to turn things around and level out the playing field?

Source
While this news is very exciting it is important to consider all sides and
not get swept up by the headlines. A lot of people writing these
headlines/pushing the hype are people who haven’t truly done their
research and can thus share analysis that is inaccurate or incomplete.
As the stories shared many times in this newsletter show, nothing is

60
61

more dangerous to normal investors like us as market hype. So let us


now look into this situation and see how this new play slots into the
bigger picture.

Photo by Mohammad Rezaie on Unsplash

61
62

Key Points
1. Will OpenAI help Microsoft stand up to Google and Meta- In
simple words, nope. And not because of the reason you’re probably
thinking off. MS hasn’t been as attention-grabbing as the other 2
Tech Giants in the strides it has made in Machine Learning.
However, make no mistakes, MS has been a big player in the field
with a lot of respectable work In 2021, I did an analysis of the best
ML company of that year. MS came out on top. Put some respect
on their name. OpenAI would add a lot of value, but MS is certainly
no slouch in the Machine Learning space. People treating the Open
AI acquisition thought it will 1000x MS ML research. This is not
true and is purely hype.
2. MS has business data- One thing that I don’t see discussed much
is the abundance of business data that MS has access to. Thanks
to MS Office, they have datasets and insights that are curated for
business users (which are a higher-paying demographic). However,
business data is also inherently harder to deal with, even for large
language models like ChatGPT (more on this in the next point).
This might end up being either a blessing or a curse, depending on
how well this is handled. If there is a niche or topic you are very
interested in, now would be the time to go deep into it.
Understanding business rules and domain logic would make you a
viable hire for anyone trying to develop AI for these domains.

62
63

3. The Problem of LLMs- By this time, you have all heard about how
ChatGPT will threaten Google. I’ve gotten more forwards about this
than Good Morning Texts. Unfortunately, I wish these technologies
were as revolutionaries as Tik Tok and LinkedIn intellectuals make
them out to be. There are still many many problems with these
systems that need to be handled when implementing them in
scalable and secure solutions. Unless these challenges are
handled, the potential of language models is severely restricted. If
you want to know more about these problems, I covered them in
my sister publication, AI Made Simple, here. It is completely free, so
you will be able to access all content without paywalls. If you’re
into detailed AI breakdowns, check it out.
4. We already have alternatives- Another fact that puts some cold
water on the hype is that other companies already have their own
variants of language models. Here is a list of 5 massive models,
that you can access completely for free. Thus, the integration of
these models is will not be as big a competitive advantage as
people are making it out to be. Again, Open AI will add a lot of
value. No doubt. But it is not the Golden Gun that people are
portraying it to be.
5. How this will affect the business- In the short and medium terms,
this will likely increase the stickiness of MS Office. Given the
almost monopoly of Microsoft Office, I don’t see them getting new
customers based on the AI integrated. This move will more likely
just help them retain clients, giving them another reason to stay. In

63
64

the longer run, it might lead to an increase in consulting-based


revenues. The combination of large troves of business data and
large computational power should lead to very high-value insights.
6. How to get into Data- This investment further shows how valuable
Data, Machine Learning, and AI are becoming in today’s climate.
Not everyone is going to be suited for working in these fields.
However, having a functioning understanding of the major ideas
will significantly increase your earning potential. If you’d like to talk
more about these fields, feel free to reach out. I’ve worked with
quite a few people at this point. And, check out my links at the end
of every links to check out my content on different platforms.

7.
8. Whether you’re a technical engineer, manager, or another kind of
tech professional, I have something for you.

I created Technology Made Simple using new techniques discovered


through tutoring multiple people in top tech firms. The newsletter is
designed to help you succeed, saving you from hours wasted on
mediocre resources or on the Leetcode grind. Easily find your needs met
in one place. I have a 100% satisfaction policy, so you can try it out at no
risk to you. Use the button below to get 20% off for up to a whole year.
Using this discount will drop the prices-

64
65

800 INR (10 USD) → 533 INR (8 USD) per Month


8000 INR (100 USD) → 6400INR (80 USD) per year
Get 20% off for 1 year
In the comments below, share what topic you want to focus on. I’d be
interested in learning and will cover them. To learn more about the
newsletter, check our detailed About Page + FAQs
If you liked this post, make sure you fill out this survey. It’s anonymous
and will take 2 minutes of your time. It will help me understand you
better, allowing for better content.
https://forms.gle/XfTXSjnC8W2wR9qT9
If you like my writing, I would really appreciate an anonymous
testimonial. You can drop it here.

Stay Woke,

Go kill all,

Devansh <3

Reach out to me on:


Instagram: https://www.instagram.com/iseethings404/
Message me on Twitter: https://twitter.com/Machine01776819
My LinkedIn: https://www.linkedin.com/in/devansh-devansh-516004168/

My content:

65
66

Read my articles: https://rb.gy/zn1aiu

My YouTube: https://rb.gy/88iwdd

66
67

How to Learn Data Structures and Algorithms


[Storytime Saturdays]
How you can use learn difficult Datastructures to ace your exams, interviews, and
jobs.
How can you study Data Structures and Algorithms?
This is a challenge that has struck every student, software developer,
and manager from the dawn of time. Picking the right approach can
make or break your company. Thus studying DSA effectively is a must
for anyone who wants to make it in the more technical components of
Tech. Which is a bummer, because there aren’t many good resources on
how to study it. Most videos/resources out there focus on Data
Structures and Algorithms for Leetcode-Style Coding Interviews. While
that is important (until the interview system is improved), it is myopic
and won’t help you develop your knowledge of DSA in-depth. This just
shoots you in the foot.
In this article, I will give you a better approach to learning DSA. One that
doesn’t involve 500+ Questions or watching 20 tutorials. And most
importantly, this method of learning these DSA will deepen your
appreciation for them, allowing you to fully utilize them when needed.
What is this mystery method? Let’s get right into it.

67
68

My writing has helped students and professionals. Hit the next level by
subscribing to the newsletter. Remember, we have a full refund policy, so
you can try at it out at no risk.

The Action Plan for Learning DSA Better


Following are the steps that you should implement to truly learn and
master data structures and algorithms. They are-
1. Understand the Story- Every DS/A was created for particular
circumstances/challenges. Understanding why it exists, the history
behind its creation, and how it slots into the current landscape are
crucial components that are often overlooked. Don’t make this
mistake.
2. Blackbox It- Now is the time to see how this idea is implemented.
People make the mistake of trying to derive it (writing merge sort
from scratch), but that is a mistake. That is for much later. Your
second step should be to view the concept from a purely functional
perspective. What is the point of this DS/A? What inputs does it
take? What outputs can it produce? This will be much easier.
3. Read Lots of Engineering Blogs/Videos- Once you have a strong
black box of this idea (you understand when this idea would be
applied and for what outcomes), it’s time to read into how this idea

68
69

has been applied in the real world. Watch the videos/read the
blogs, to see how different teams applied this idea to solve
problems. These blogs/videos are great for various reasons- they
help you see how people are solving problems IRL, appreciate the
tradeoffs you would have to make when designing systems, and
see how this concept slots into larger systems. This is the step you
can’t skip if you want to reach the expert level.
4. Try to Spot it in real life- Once you have a deep appreciation of the
idea, now is the time to start trying to spot different
implementations of this idea. Say you’ve just learned about Graphs
and their relational nature. You know you can use them to visualize
the components of your system. Now is when you think about how
you could possibly use GNNs and their ability to help you spot
fraud. Think about engineers at Facebook might use it to create
more personalized ads. This step is crucial in translating technical
challenges into business outcomes.
5. Peel back the Layers and Repeat- Finally, we come to the step that
most people do first (and thus they struggle with learning). Once
you have a very strong understanding of the utility of the concept, it
is now time to start understanding the theoretical basis. What is
the proof for certain bounds? How can you derive the important
algorithms? This is the final step. This step will add a lot of solidity
to your knowledge. And it will teach you the problem-solving
techniques to invent ideas of your own.

69
70

This approach works because it mimics how knowledge is created. Most


textbooks/lectures teach you ideas by first making you prove the
properties and then talking about the utility. However, actual knowledge
is created in the opposite way (even in fields like Math and AI).
Researchers start with a challenge, try to figure out what kinds of
solutions would help them solve it, do their research, and build their
ideas by working backward from the end goal. Utilize this technique, and
you will see the results skyrocket.
Necessity is the Mother of Invention. To try and study concepts without
understanding why they were necessary is a serious waste of your time
and energy.
For those of you that want to understand why this works in more detail,
read on.

70
71

Photo by Soundtrap on Unsplash

71
72

Why This Approach will help you learn


To first understand why this approach will help you, let’s first understand
why most people struggle with self-studying.
So why do people struggle when they try to self-study Data Structures
and Algorithms?
Simply put, it is because they fail to understand the context of what
they are learning. Their focus will be on the Data Structure/Algorithms
and their properties. They will study the proofs, try to code up the
concept from scratch, and try to do some basic problems with it. But
that’s it. Very rarely is the context of why these ideas were developed
given any weightage. They will not look into how it slots into the larger
tech landscape.

No matter how well the student did in their theoretical CS course, they
don’t look at their code compiling and think of the Backus–Naur Form and
the developers of the language might have used it.

-Personal Observation

The problem with this is that they are learning these ideas in isolation.
Even if they are able to get through all the technical proofs and get to use
the idea, they only really master the concepts in isolation. You may be
able to build complex neural networks completely from scratch, but that
means nothing if you lack the insight as to when neural networks should

72
73

be applied to improve performance, and when it makes more sense to


accept lower performance for other reasons.
This problem is prominent in not only Computer Science but other
theoretical fields like Math. The next time you hear someone say, “Ideas
like Trig, Calculus, and Linear Algebra are not useful” remember this
post. It’s the exact same problem. People are learning facts and
theories, instead of solutions to problems.
Here is why my suggested approach is different. Firstly, notice that the
theoretical properties are deprioritized in favor of focusing on how this
idea can be utilized fully. This approach will force you to consider the
tradeoffs and see what properties of a particular idea/concept are more
useful/show up more often. This will help you truly learn on a deeper
level, as your mind is being forced to analyze and create its solutions.
This deepens the connections between the neurons, making you more
proficient at the task.

73
74

Notice how this plan is geared at hitting the higher levels of learning.
Read more
When you learn the history behind an idea, force yourself to evaluate the
strengths and weaknesses, and try to think of how variants can be
developed, you are engaging with the higher levels of learning. Even if
you’re not successful (you probably won’t get the full scope), your
learning will be on steroids.

74
75

There’s a reason that my readers are able to ace their interviews, even
when they don’t get exactly the same questions. Because they develop
insight into these ideas.
For a practical example of how understanding the full nuance of a Data
Structure can be key to mastering it, take a look at the post I did on
spotting graphs in your interviews. The framework for spotting the
graphs comes out of understanding why Graphs are powerful and how
they help us encode relationships. Students have utilized it for great
results. I’m sure you will too.
Loved the post? Hate it? Want to talk to me about your crypto portfolio?
Get my predictions on the UCL or MMA PPVs? Want an in-depth analysis
of the best chocolate milk brands? Reach out to me by replying to this
email, in the comments, or using the links below.

Stay Woke,

Go kill all,

Devansh <3

Reach out to me on:


Instagram: https://www.instagram.com/iseethings404/
Message me on Twitter: https://twitter.com/Machine01776819
My LinkedIn: https://www.linkedin.com/in/devansh-devansh-516004168/

75
76

My content:
Read my articles: https://rb.gy/zn1aiu
My YouTube: https://rb.gy/88iwdd

76
77

System Design Mock Interview: Design


TikTok ft. Google TPM[System Design
Sundays]

We haven't done a mock interview in a while, so this will be fun.

One of you reached out and texted me that I hadn’t covered a mock
interview in a while,
I went back through the archives and turns out this was very true.
Anyone who has worked with me knows that I’m a huge believer in the
power of watching mock interviews in learning to communicate
better/come across new ideas. It’s similar to how athletes study footage
of top performers and how writers are told to read a lot to improve the
quality of their work.
So here is another excellent mock interview for you to study. Make sure
you watch the video, study the points he makes, and think about whether
you agree or disagree with them. How would you do things differently?
As we covered in the how to learn DSA post yesterday, making your
compare and contrast various ideas is a great way of learning the idea
on a deeper level.

77
78

As you watch the Mock Interview, here are a few things I want you to look
out for. These are things that I think the interviewee did really well, that
you should definitely integrate into your mock interviews. I’ll also leave
some actions you can take, to further improve upon this performance.

Things to Look Out For


1. Don’t be afraid to ask questions to clarify- Notice how instead of
jumping straight in, Adam takes his time understanding what Tik
Tok is. He has the interviewer explain the important parts of how
TT functions. Steal this technique. Asking the interviewer to explain
what they are asking for is a great way to understand what the
interviewer values.
2. Focus on your strengths- Notice how Adam immediately jumps
into the backend focus. People feel overwhelmed by the amount of
information they feel like they have to know for the System Design
Interview. TikTok has video storage, recommendations, app
development, recommendation algorithms, and other complex
challenges. Instead of worrying about everything, divert the
attention to where you are strongest.
3. Define an MVP and link it to your user experience- One of the most
beautiful things that Adam did comes towards the beginning of this
video. As he starts to define the requirements for the product, he
also keeps linking the app back to the users and their needs. In this

78
79

he does two things well- he defines a minimum viable product, and


he builds a client persona for whom he can build the app. Go out of
your way to make this explicit in your interviews. Thinking of your
customer needs is an important skill, one that is often overlooked
by engineers.
4. Improvements #1, You can always improve- Towards the end, the
interviewer asks “Would you like to add something to your
product?”. This is where Adam slipped up a bit. When you’re asked
something like this, the answer is always yes. However, sometimes
you will not have much to add. In such cases, I would suggest
taking a more macroscopic view of the system. How can you
integrate this system into a larger ecosystem? What would need to
be tackled? This shows off your ability to consider the future. As
we’ve already covered in our post about what makes great software
devs, considering the future is an important skill to become a great
developer.
5. Improvement #2, Consider the Competition - When talking about
developing apps like TikTok (where there is a lot of competition),
spend some time talking about their rival apps and what they are
doing. Both for copying and for differentiation. Talk about some of
the ways challenges are handled, features are built, or other such
insights that the competitors had that you would copy. Bonus point
if you can mention a relevant publication related to the topic. How

79
80

do you keep in touch with the various developments? Show up to


Finance Fridays and StoryTime Saturdays. I cover such
developments and their implications a lot. Aside from this, a good
shot is to follow various creators and build up a set of sources who
you look to for analysis and news. I will be sharing my list very
soon. If you have any people you really like, let me know.

6.

One of the reasons I can get the most impactful trends is that I study
information from a variety of sources. Helps me understand topics
better.

System Design Mock Interview: Design TikTok ft. Google TPM

With all these points covered, it is now time for you to watch and learn
from the mock interview. Happy Watching my dearest cult member.

I created Technology Made Simple using new techniques discovered


through tutoring multiple people in top tech firms. The newsletter is
designed to help you succeed, saving you from hours wasted on
mediocre resources or on the Leetcode grind. Easily find your needs met

80
81

in one place. I have a 100% satisfaction policy, so you can try it out at no
risk to you. Use the button below to get 20% off for up to a whole year.
Using this discount will drop the prices-
800 INR (10 USD) → 533 INR (8 USD) per Month
8000 INR (100 USD) → 6400INR (80 USD) per year
Get 20% off for 1 year
In the comments below, share what topic you want to focus on. I’d be
interested in learning and will cover them. To learn more about the
newsletter, check our detailed About Page + FAQs
If you liked this post, make sure you fill out this survey. It’s anonymous
and will take 2 minutes of your time. It will help me understand you
better, allowing for better content.
https://forms.gle/XfTXSjnC8W2wR9qT9
If you like my writing, I would really appreciate an anonymous
testimonial. You can drop it here.

Stay Woke,

Go kill all,

Devansh <3

Reach out to me on:

81
82

Instagram: https://www.instagram.com/iseethings404/
Message me on Twitter: https://twitter.com/Machine01776819
My LinkedIn: https://www.linkedin.com/in/devansh-devansh-516004168/

My content:
Read my articles: https://rb.gy/zn1aiu

My YouTube: https://rb.gy/88iwdd

82
83

How to Invent Math[Technique Tuesdays]


A step by step process into inventing your own functions and metrics
One of the things that shocks a lot of people when I talk to them is the
fact that I have invented my own metrics. In fact, when it comes to
heavy-duty AI/Data Science work, chances are that you will eventually
have to eventually invent a quantification metric of your own. A metric
that doesn’t exist in standard literature, but was created to solve your
own particular problem.
If you’re a software engineer, having the ability to quantify your scenarios
in novel ways can be a game changer. It can help you see situations in a
new light, learn about blockages in your system and ultimately create
innovative solutions for yourself.

83
84

Photo by Maria Teneva on Unsplash


In this post, I will teach you how to invent your own Math. We will cover
the basic steps you need to craft solutions that are perfect for your
specific challenges. And don’t worry, you won’t need to be a Math prodigy
for this. Basic Math Knowledge, Problem-Solving Ability, and a flexible
mind are the only prerequisites.

84
85

Coding Interviews Made Simple was the old Name, hence which is why
this is mentioned in the review.
Sound like a Jam? Let’s get right into it. This might get a little abstract
for you, so I have a video linked below where you can apply this process
first-hand.

How to Invent your own Math


1. Understand the Problem- The first step to inventing your own Math
is to understand the problem you’re currently dealing with.
Specifically, you want to focus on the problem you’re dealing with,
and pull out the important details. This will guide everything else.
2. Use basic operations- In most metrics, you will largely be using
basic operations- division, multiplication, addition, and subtraction.
Here are a few more to add to your tool belt- log, exponents,
powers, and absolute values. These will form a strong basis for
most of the metrics you build. I will do separate Math Mondays on
these operations and the flavor that each adds to your solutions.
3. Use the existing ideas- Chances are that there are existing metrics
that can be used to quantify the value you are trying to solve. It
won’t do it well, but it will work. More than often, your invention will
then be a twist using this idea as a baseline. For example, for one
of the metrics I invented, I used the popular Mean Squared Error as
a baseline.

85
86

4.
5. Recognize the problem with the existing metric- Next step is to
figure out what exactly the problem your current metric is. In my
case, we noticed that MSE flattens the multi-dimensional errors.
We were working with a multi-variate prediction system, where
each target value had a different priority and units of
measurement. Blindly applying MSE would not allow us to study
the prediction engine in depth. So we made a few changes, using
MSE as a baseline to create a new metric that helped us calculate
our system’s weighted deviation from expected values. Once you
have figured out the problem, make the required changes, using the
operations described.
6. Keep Going Back to your Metric- Remember that any metric you
use (whether your own or a standard one) is not a gift from God.
Changing it will not cause the next great flood. Every Metric comes
with certain assumptions and simplifications you make about the
problems you’re solving. You have to keep going back and revising
the metric, at least checking if it is still valid. Far too often, teams
get married to their metric and dedicate their resources to
improving it. Remember, the goal is not to get a high score/low error,

86
87

the goal is to build systems that are useful to people. Sometimes,


that involves changing your evaluation metrics to suit your new
circumstances.

This video by the Amazing Creator RitvikMath is a great example of this


process. It goes into the KL Divergence, a popular metric in Data Science
and Deep Learning. While it doesn’t ‘invent’ a new metric, it does
highlight the process from scratch. Take a look and make notes of each
step.

87
88

A reminder to anyone looking for work- I post job openings very regularly
on my Instagram stories. By following me there, you can get access to
job openings for free. My Instagram can be found here (@iseethings404)
I created Technology Made Simple using new techniques discovered
through tutoring multiple people in top tech firms. The newsletter is
designed to help you succeed, saving you from hours wasted on

88
89

mediocre resources or on the Leetcode grind. Easily find your needs met
in one place. I have a 100% satisfaction policy, so you can try it out at no
risk to you. Use the button below to get 20% off for up to a whole year.
Using this discount will drop the prices-
800 INR (10 USD) → 533 INR (8 USD) per Month
8000 INR (100 USD) → 6400INR (80 USD) per year
Get 20% off for 1 year
In the comments below, share what topic you want to focus on. I’d be
interested in learning and will cover them. To learn more about the
newsletter, check our detailed About Page + FAQs
If you liked this post, make sure you fill out this survey. It’s anonymous
and will take 2 minutes of your time. It will help me understand you
better, allowing for better content.
https://forms.gle/XfTXSjnC8W2wR9qT9
If you like my writing, I would really appreciate an anonymous
testimonial. You can drop it here.

Stay Woke,

Go kill all,

Devansh <3

89
90

Reach out to me on:


Instagram: https://www.instagram.com/iseethings404/
Message me on Twitter: https://twitter.com/Machine01776819
My LinkedIn: https://www.linkedin.com/in/devansh-devansh-516004168/

My content:
Read my articles: https://rb.gy/zn1aiu

My YouTube: https://rb.gy/88iwdd

90
91

Problem 72: Permutation in String [Amazon]

Binary Search Trees, Recursion, Graph Traversal Algorithms

I’m excited to share today’s problem with you. It’s a great practice
question, one that can teach you a lot.

This problem can be found as problem 98. Validate Binary Search Tree

Problem
Given the root of a binary tree, determine if it is a valid binary search tree
(BST).
A valid BST is defined as follows:
● The left subtree of a node contains only nodes with keys less than
the node's key.
● The right subtree of a node contains only nodes with keys greater
than the node's key.
● Both the left and right subtrees must also be binary search trees.

91
92

Example 1:

Input: root = [2,1,3]

Output: true

Example 2:

Input: root = [5,1,4,null,null,3,6]

Output: false

92
93

Explanation: The root node's value is 5 but its right child's value is 4.

Constraints:
● The number of nodes in the tree is in the range [1, 104].
● -2^31 <= Node.val <= 2^31 - 1

You can test your solution here

I created Technology Made Simple using new techniques discovered


through tutoring multiple people in top tech firms. The newsletter is
designed to help you succeed, saving you from hours wasted on
mediocre resources or on the Leetcode grind. Easily find your needs met
in one place. I have a 100% satisfaction policy, so you can try it out at no
risk to you. Use the button below to get 20% off for up to a whole year.
Using this discount will drop the prices-
800 INR (10 USD) → 533 INR (8 USD) per Month
8000 INR (100 USD) → 6400INR (80 USD) per year
Get 20% off for 1 year

93
94

In the comments below, share what topic you want to focus on. I’d be
interested in learning and will cover them. To learn more about the
newsletter, check our detailed About Page + FAQs
If you liked this post, make sure you fill out this survey. It’s anonymous
and will take 2 minutes of your time. It will help me understand you
better, allowing for better content.
https://forms.gle/XfTXSjnC8W2wR9qT9
If you like my writing, I would really appreciate an anonymous
testimonial. You can drop it here.

Stay Woke,

Go kill all,

Devansh <3

Reach out to me on:


Instagram: https://www.instagram.com/iseethings404/
Message me on Twitter: https://twitter.com/Machine01776819
My LinkedIn: https://www.linkedin.com/in/devansh-devansh-516004168/

My content:
Read my articles: https://rb.gy/zn1aiu

My YouTube: https://rb.gy/88iwdd

94
95

[Solution]Problem 72: Permutation in String


[Amazon]
Binary Search Trees, Recursion, Graph Traversal Algorithms

How did you with this question? I’d love to hear from you.

95
96

This problem can be found as problem 98. Validate Binary Search Tree

Problem
Given the root of a binary tree, determine if it is a valid binary search tree (BST).

A valid BST is defined as follows:

● The left subtree of a node contains only nodes with keys less than the node's key.
● The right subtree of a node contains only nodes with keys greater than the node's key.
● Both the left and right subtrees must also be binary search trees.

Example 1:

Input: root = [2,1,3]


Output: true

Example 2:

96
97

Input: root = [5,1,4,null,null,3,6]


Output: false
Explanation: The root node's value is 5 but its right child's value is 4.

Constraints:

● The number of nodes in the tree is in the range [1, 104].


● -2^31 <= Node.val <= 2^31 - 1

You can test your solution here

Proven results, backed by the only refund guarantee in the space. What’s
stopping you from taking that next step.

Step 1: Going through the Brute Force


This is a relatively straightforward question to understand. BST are ideas
that you should all be familiar with(If you’re struggling with them, make

97
98

sure you check out the how Master DSA guide here). Since they are such
a core concept, I don’t think any interviewer would need you to flesh out
the nuances and really look into the definitions. Therefore it makes a lot
more sense to jump into creating the brute-force first, since it saves you
a lot of time.
What would the brute force of this validation be. Simple. We could do the
following-
start at the node.
Check if children are compliant with the requirement
Then keep going down, checking if the other descendants match meet
this requirement.
This should make a few things clear. The brute-force would implement a
kind of recursive DFS. We would use a node and we go through every
subtree to confirm whether the subtree is a BST, both by itself, and with
the original source node.

98
99

Visualizing a DFS, if anyone needs a refresher. Source


This solution would work. But as with all brute-force solutions, it will be
slow. Pause right here and try to calculate the time complexity of this
approach. If you get it right, you get ice-cream.
No cheating.
Trust me, this is good practice.
Running this operation will require O(N^2) time complexity. For every
node, you have to check both the children, and all it’s the other
descendants in the subtree. This goes out of control since you have to
do this for every node in the tree.

99
100

So how do we improve this? We go back to our reliable way of optimizing


the solution from the brute-force. We analyze the brute-force, and
identify what properties about the inputs we are not utilizing. Once we
understand this, we can look for solutions by optimizing the slow
portions.
Prepare to get jiggy.

Step 2: Looking at the Brute Force


So what makes our brute force solution…brutish?
The major operation we perform is the comparison. In our current
approach, we’re doing a lot of repeated work. Once we already validate a
parent subtree, we know that the children trees are valid. However, out
current approach doesn’t allow that. It will then cover the children tree as
well. And on and on and on….
One way to get around this remember a very basic rule in math. If A>B
and B>C, then A>C. Same for the lesser than relation. To those of you
that want to really flex your knowledge in interviews, this is called the
transitive property. Make sure you hit the interviewer with the sweetest
Johnny Bravo pose as you spit these words out. Adds a lot of extra
impact.

100
101

Image Source
Why is this relevant? Look back our current brute-force. We do a lot of
repeated work because once we have validated one subtree, we don’t
discard all of our computations to get the results. We don’t really take
advantage of the unique structure of the Binary Search Tree or the
transitive property of inequality to speed up our operations. So as a
natural next step, it’s now time to look into this.

Step 3: Improving Our Solution

101
102

Let’s take a second to think about what truly makes a valid BST. Given a
node can we come up with some rules to determine if it is part of a valid
subtree?
We know that a node has to be greater than all the nodes to it’s left and
smaller than all the nodes to it’s right. Another, easier way to say this is
that it must be in a certain range. It will have to be greater than the
biggest value to it’s left and lesser than the smallest value to it’s right.
We encode this insight with the following condition-
(node.val < right and node.val > left)
So how do we go about getting the left and right?
We already know what they are. We will get them from the nodes we
have already visited. How? Here is the process-
1. We know that if we consider just the root, then every value is a valid
BST. Thus, our left and right range would be bounded between +/-
infinity.
2. If we go to the left subtree of a node, then we know that the node’s
value is the maximum acceptable value. Anymore, and our tree is
no longer to a BST. Thus we should step into the subtree and
change the right bound to the node.val.
3. The opposite is true when we step into the right subtree. Now,
every value must be greater than the current node value. So we
change the left bound to reflect this property.

This gives us all the necessary pieces to put the final solution. Before
you proceed, drink some water. Reread everything we have covered so
far. Make sure it makes sense. Step away from the screen and come
back in 10 minutes. Make sure things still make sense. This is a very

102
103

problem-solving heavy question. Making sure you understand the flow of


ideas is crucial. If you don’t understand anything after re-reading, leave it
in the comments, message me using my social media links, or simply
reply to this email. It’s extremely important you understand the details.
Now let’s get to coding things up.

Step 4: Coding It Up
If you’re here, coding things should not be too hard. If you have a hard
time coming up with code in a methodical way, check out the recursive
template that we covered here. Since we don’t have any side effects, the
first 3 steps are the ones that are relevant. Take a look at the them
below-

103
104

Now compare this with the solution code. Notice how smoothly this
works. I wrote this template months ago. That is the power of drilling
down to the basics and building up from there.
class Solution:
def isValidBST(self, root: TreeNode) -> bool:
def valid(node, left, right):
if not node:
return True
if not (node.val < right and node.val > left):
return False

return valid(node.left, left, node.val) and valid(node.right,


node.val, right)

#call the helper


return valid(root, float('-inf'), float('inf'))

104
105

Time Complexity- O(n)

Space Complexity- O(log n) [counting the stack frame]. Worst case O(n)- happens
when tree is very unbalanced.

Loved the solution? Hate it? Want to talk to me about your crypto
portfolio? Get my predictions on the UCL or MMA PPVs? Want an
in-depth analysis of the best chocolate milk brands? Reach out to me by
replying to this email, in the comments, or using the links below.

Stay Woke,

Go kill all,

Devansh <3

Reach out to me on:


Instagram: https://www.instagram.com/iseethings404/
Message me on Twitter: https://twitter.com/Machine01776819
My LinkedIn: https://www.linkedin.com/in/devansh-devansh-516004168/

My content:
Read my articles: https://rb.gy/zn1aiu

My YouTube: https://rb.gy/88iwdd

105
106

How I networked with one of the most


prominent Data Scientists online[Storytime
Saturdays]
The steps I took to meet Ken Jee, a Data Scientist whose work reaches millions.
How can you network with well-established individuals in your domain,
especially when you’re a nobody? A lot of you have asked me this.
Whether it is for a referral, guidance on a particular venture you’re
working on, or for any of many other reasons that you would want for
adding people to your network, the art of networking is one of the most
useful skills to add to your toolbox. However, people often struggle to
network effectively. Whether it is for personal growth, career progression,
or helping someone out, having a strong network is a great asset to rely
on.
In this post/email, I will cover the story of how I was able to network with
Ken Jee, one of the most prominent data scientists online. He has
phenomenal videos catered towards beginners, aimed at helping them
develop the skills to break into Data Science and Machine Learning. He
has established himself as one of the most prominent voices in the
domain. Ken and I have been able to develop a good relationship, which
even culminated in my appearance on his excellent Podcast (which you
can watch here).
Some of you might be skeptical because I have an online presence
myself. You may not have the same leverage in this regard. However, I

106
107

met Ken in Jan 2022, before I had real ‘clout’. Back then, I had started to
commit more to my writing. This newsletter had fewer than 100 readers
(and 0 paying subs). Back then, I was a complete nobody. However,
using the principles that I will go over in this article, I was able to stand
out from the thousands of other people who try to reach out to him. And
you will too.

Photo by Brooke Cagle on Unsplash


For another proof of this approach working, here is the video on how I
got my first 100 USD/hour contract, without even graduating from
university. I got this role, because of networking with the right people.
This gave me the opportunity to show off my knowledge/skills to the
right individuals, which ultimately lead to the contract.

107
108

Devansh is the ninja of networking.


-My grandma (hopefully)
Sound like a good time? Let’s get right into it.

The Story
1. Find their work- The first and most overlooked step to networking
with people, especially those that are more prominent is to really
seek out their work. What does this mean? Say you wanted a
referral from an employee at Google named DJ-EQ. The standard
advice is to send a connection request, saying something like, “Hey
DJ-EQ, I am interested in working at Google. Have a few questions,
that I would love to get your input on. Would love to connect and
talk further“. If you’re from the same university/city/former
company, you might throw that in. This is not bad advice, but it is
extremely boring. This will work if you have a strong connection
with them (mutual friends, you’re involved in something they’re
passionate about, etc), but there’s a high likelihood you’ll be
ignored. A better bet is to find their work. Go through their old
posts/Googling them online and find out something that you can
use as a crutch to reach out to them. This gives them a reason to
want to talk to you, beyond just the frame of them being an
employee at a company you’re into. In Ken’s case, this was
relatively straightforward. He has a giant YouTube channel, in a
very similar domain to mine (my work is geared more towards

108
109

advanced practitioners, but it is still in Data and Machine Learning).


Once you have a crutch to begin, the next step becomes crucial.
2. Engage on their terms- Once you find their work, your best bet is to
engage with people on their terms. Since Ken has a huge YouTube
channel, I engaged with his work by commenting on his videos. I
would watch his videos and do my best to leave a comment to add
value. By constantly sharing valuable comments, I was able to
stand out in the comments section. He (and his viewers)
appreciated what I had to say and this encouraged them to engage
with me further. This worked out much better than I was expecting
since it lead to Ken subscribing to my YouTube channel. Keep in
mind, I had no viewers/subs at this point, and my production
quality/presentation was terrible. I had no memes!!!

3.
4. Image Source
5. Speak their lingo- An important component of the above point is to
speak the language of the people you’re talking to. Ken’s videos are
geared towards beginners and focus more on the
behaviors/principles that allow data scientists to excel. It would be
foolish for me to go into my AI Research breakdowns or use more
advanced jargon. I save this for a creator like Yannic Kilcher, who
covers the important developments in Machine Learning and AI
Research.

109
110

6. Be a middleman- Once this person has become familiar with your


presence, you drop this nuke on them. Of all my networking
techniques, this is probably the most impactful. You reach out to
this person and offer to introduce them to another group/person
that is of interest to them. I did so by introducing Ken to Patrick
Akil, the host of the exceptional Beyond Coding Podcast, and other
possible guests. I had no real friendship with either, but I knew that
they were both engaged with work that the other would find
valuable. You too can apply this. Take 2 people/groups that are
doing great work, and tell them both that you would love to connect
them with the other. They will both generally say yes and will be
grateful for you. And you will be able to see amazing work out of it
(both Ken and Patrick appeared on each other’s podcast and the
results were bangers. Catch them here and here).
7. Have hobbies- One of the best ways to have deeper relationships
with people is to have common interests with them. This allows
you to deepen your relationship. By showing common interests,
you allow the people you’re reaching out to see you as more than a
LinkedIn profile. They start to see you as a person. I call this,
getting drunk with people of common interest (after how Software
Legend Harish Mehta used this alcohol to get very strong
personalities to work together). It is a crucial part of developing
your relationship with people that you want to work with. By having
a wide array of interests, you increase the chances of having
common hooks that you can use to engage with a multitude of
people.
8. Closing Thoughts- There is a strong element of luck involved in this
process. My connection with Ken was more due to the fact that he
reciprocated my engagement than it was my own genius. If you
apply this approach, you will hear a lot of nothing. People will go
ghost, not reply to you, etc. Don’t take this personally. That is
expected. Eventually, you will figure whose not receptive. Drop the

110
111

amount of time you spend reaching out to them, and spend time on
the ones that appreciate your presence. Say your goal is to reach
10 people per week. If 20% of people reply, that’s 2 new engaged
connections per week. Don’t underestimate how much of an
impact this can make.

9.
10. Even in this newsletter, which people have to sign up for, only
about 20% of people open my emails regularly. When you’re trying
to work with people, keep a thick skin.

Once you actually add a person to your network, you want to water your
garden and foster your relationship with them. I will do a separate post
on this, so keep your eyes peeled. In the meantime, use these techniques
to stand out and network with Tech Leaders, the right way.
Loved the post? Hate it? Want to talk to me about your crypto portfolio?
Get my predictions on the UCL or MMA PPVs? Want an in-depth analysis
of the best chocolate milk brands? Reach out to me by replying to this
email, in the comments, or using the links below.

Stay Woke,

111
112

Go kill all,

Devansh <3

Reach out to me on:


Instagram: https://www.instagram.com/iseethings404/
Message me on Twitter: https://twitter.com/Machine01776819
My LinkedIn: https://www.linkedin.com/in/devansh-devansh-516004168/

My content:
Read my articles: https://rb.gy/zn1aiu

My YouTube: https://rb.gy/88iwdd

112
113

How to ARCHITECT a search engine like


Google Search[System Design Sundays]
Everyone wants to be a software engineer at Google.
Today I will go a step beyond. I will teach you how to be the software
engineer of Google :))
I came across a wonderful post about this topic by the exceptional, AI
Edge newsletter. Damien is a very new writer on Substack, but his
content is god-tier. If you are interested in learning about Machine
Learning System Design, make sure you subscribe to it. It is one of the
newsletters I recommend on my other Substack Publication, AI Made
Simple. Damien’s post is extremely detailed, so I will cover some
concepts that stood out to me. If you want to learn more about this topic,
I will link his original post down below. You can go check it out.
There are more than 100B indexed websites and ~40K searches per
second. The system needs to be fast, scalable and needs to adapt to the
latest news!
-An idea of the scale of this system.

Key Principles
1. Good Cakes have layers- Far too often, the temptation while
designing systems is to spend a lot of time and resources trying to
engineer the perfect solution for individual tasks. This is very costly
and time-consuming. You’re much better off layering multiple

113
114

smaller solutions onto each other to create a bigger system. As


Damien explores the possible architecture of Google, you will see
multiple examples where he talks of combining smaller systems
for better results. This is generally accomplished by having simpler
filtering mechanisms to run a query through a large corpus of
search documents, and then using a more complex system to
create the final result.

2.
3. Handling Multi-Modal Search- Google search consists of far more
than images. We have images, text, gifs, and videos (in multiple
languages). How can you build an engine to accommodate all of
this? How can we compare the difference in the quality of search
output for the various kinds of search results? One easy solution is
to use User Engagement. Using user engagement to train a
Universal Search Aggregator and your other models would work
well. If I had to make a prediction for the future, my guess is that
Google is working on transcribing the various outputs into a
common latent space. This would allow them to integrate YouTube,
into their search results more heavily. As of now, the knowledge on
YouTube has been largely untouched (videos are linked in search
results but that’s it).

114
115

4.
5. On the labeling of data- Damien rightly points out that manually
labeling data at the scale of Google is not practical. I think they
handle this problem using semi-supervised labeling. This approach
can be used to handle lots of unlabeled data, and it tends to work
very well. The image below is one such example of Google
Researchers using SSL to hit peak performance.

115
116

To learn more, check out my breakdown of their approach here


These were the important principles that stood out to me in Damien’s
write-up. Now go ahead and read his breakdown of the Search System. It
is fairly dense, but it’s worth it (especially if you are into Machine
Learning).

I created Technology Made Simple using new techniques discovered


through tutoring multiple people in top tech firms. The newsletter is
designed to help you succeed, saving you from hours wasted on
mediocre resources or on the Leetcode grind. Easily find your needs met
in one place. I have a 100% satisfaction policy, so you can try it out at no

116
117

risk to you. Use the button below to get 20% off for up to a whole year.
Using this discount will drop the prices-
800 INR (10 USD) → 533 INR (8 USD) per Month
8000 INR (100 USD) → 6400INR (80 USD) per year
Get 20% off for 1 year
In the comments below, share what topic you want to focus on. I’d be
interested in learning and will cover them. To learn more about the
newsletter, check our detailed About Page + FAQs
If you liked this post, make sure you fill out this survey. It’s anonymous
and will take 2 minutes of your time. It will help me understand you
better, allowing for better content.
https://forms.gle/XfTXSjnC8W2wR9qT9
If you like my writing, I would really appreciate an anonymous
testimonial. You can drop it here.

Stay Woke,

Go kill all,

Devansh <3

Reach out to me on:


Instagram: https://www.instagram.com/iseethings404/

117
118

Message me on Twitter: https://twitter.com/Machine01776819


My LinkedIn: https://www.linkedin.com/in/devansh-devansh-516004168/

My content:
Read my articles: https://rb.gy/zn1aiu

My YouTube: https://rb.gy/88iwdd

118
119

Group Theory. The Math Twin to Object


Oriented Programming[Math Mondays]
One of the greatest Math Ideas to become a 10x programmer.
How can you become a better software engineer/tech manager?
By implementing techniques and principles from various disciplines into your work. Having a
giant toolkit can be a game changer in being more effective in your work. One of my favorite
examples is the story of the engineer who went from SW2 (entry-level developer) to Principal
(one of the senior-most positions) in 4 Years, which we covered here.

Photo by Mailchimp on Unsplash


In today’s post, we will be covering why should learn Group Theory in order to write code that is
more modular. In particular, group theory (which is like the Math variant of Object Oriented
Programming) will help you take your OOP design to a whole other level. Whether you’re a
developer looking to improve code quality (look into this guide on cleaner code) or a manager
looking to design better systems, this is not a piece you want to miss.

119
120

In mathematics, a group is a set and an operation that combines any two elements of the set to
produce a third element of the set, in such a way that the operation is associative, an identity
element exists and every element has an inverse. These three axioms hold for number systems
and many other mathematical structures.
-The definition of a group can easily be applied to objects and instances.

Key Highlights
1. What is Group Theory- Group theory is a branch of math that
studies the groups. The principles of group theory help in
understanding the concept of inheritance and polymorphism in
OOP.
2. What is Inheritance in OOP? How Groups are relevant- Inheritance
in OOP allows classes to inherit properties from their parent
classes, just like groups can inherit properties from their
subgroups. In this way, objects can be organized in a hierarchical
structure, with common properties defined at higher levels and
specialized properties defined at lower levels.
3. What is Polymorphism in OOP? How Groups are relevant-
Polymorphism allows objects to take on multiple forms. This
concept is modeled by group actions, where the elements of a
group act on a set to produce new elements, just as objects can
take on different forms based on their methods.
4. Group Theory as a Framework for design- Group theory also
provides a framework for understanding the relationships between
classes and objects in OOP. This can be useful in creating more
efficient algorithms and designing more modular systems.
5. Where to learn it- YouTube and other online platforms have tons of
courses. Take a look through them and try some out. For a guide
on how to learn it better, check out my post on why math is a

120
121

language. Also, make sure you’ve read all the other posts on the
recommended reading list right here.

You should see that Group Theory provides valuable insights into the
concepts of inheritance and polymorphism in OOP. It can help you in
designing more organized, efficient, and modular systems. So don’t sleep
on it.

Testimonials are always appreciated. Drop them by replying to this email,


or in this Google Form right here
I created Technology Made Simple using new techniques discovered
through tutoring multiple people in top tech firms. The newsletter is
designed to help you succeed, saving you from hours wasted on
mediocre resources or on the Leetcode grind. Easily find your needs met
in one place. I have a 100% satisfaction policy, so you can try it out at no
risk to you. Use the button below to get 20% off for up to a whole year.
Using this discount will drop the prices-
800 INR (10 USD) → 533 INR (8 USD) per Month
8000 INR (100 USD) → 6400INR (80 USD) per year
Get 20% off for 1 year
In the comments below, share what topic you want to focus on. I’d be
interested in learning and will cover them. To learn more about the
newsletter, check our detailed About Page + FAQs

121
122

If you liked this post, make sure you fill out this survey. It’s anonymous
and will take 2 minutes of your time. It will help me understand you
better, allowing for better content.
https://forms.gle/XfTXSjnC8W2wR9qT9
If you like my writing, I would really appreciate an anonymous
testimonial. You can drop it here.

Stay Woke,

Go kill all,

Devansh <3

Reach out to me on:


Instagram: https://www.instagram.com/iseethings404/
Message me on Twitter: https://twitter.com/Machine01776819
My LinkedIn: https://www.linkedin.com/in/devansh-devansh-516004168/

My content:
Read my articles: https://rb.gy/zn1aiu

My YouTube: https://rb.gy/88iwdd

122

You might also like