Fernando 🇮🇹🇨🇭 Profile picture
Software Engineer for 15+ years • Algorithms, Distributed Systems, System Design, Computer Vision • Dad & husband • I write https://t.co/0II04k6k3Z
12 subscribers
Feb 1 8 tweets 2 min read
Solving 300+ LeetCode problems doesn't mean you'll pass your coding interview.

What holds you back are not your coding skills but the way you approach problems.

If you want to do better, use this practical 7-step strategy: ↓ Step 1: Listen

Pay close attention to the problem description and catch every detail.

Each piece of information is crucial in finding the optimal solution.

For example, if the interviewer gives you sorted input data, this likely affects the optimal solution.
Jan 18 7 tweets 2 min read
Many software engineers have trouble with recursion during coding interviews.

If you want to become good at solving such problems, learn these 6 templates: ↓ 1. Iteration

Any problem that can be solved with loops can also be solved using recursion.

Sometimes recursion provides a more concise and elegant solution, even if less efficient.

Example:

- traversing a linked list in reverse order
Jan 11 8 tweets 2 min read
The sliding window method isn't just a trick for coding interviews.

It's the cheat code for cracking most array and string problems.

Here's how you can quickly grasp and use it: [1/7] ↓ Image A sliding window is a subarray that moves from left to right through an array.

The window is defined by two pointers representing its left and right bound.

The window size can be fixed or variable.

[2/7]
Jan 4 5 tweets 2 min read
Most developers don't use trees in their daily work.

But the reason is that they're avoiding tree problems.

You won't need to do that anymore once you know these 4 data structures: ↓ Image 1. Binary Search Trees (BST)

It's a constrained extension of a binary tree with a unique property.

Given a node, the value of its left child is less than or equal to the parent value.

The value of the right child is greater than or equal to the parent's value

The primary use cases of BSTs are:

- implement simple sorting algorithms
- maintain a sorted stream of data
- implement double-ended priority queues

The most popular BST implementations are balanced trees like Red Black or AVL.
Dec 4, 2024 6 tweets 4 min read
If you want to get better at system design and scaling apps, read these blog posts from big tech companies (Netflix, Uber, Stripe, OpenAI, Airbnb..): ↓ 1. Netflix: Extracting Image Metadata at Scale

netflixtechblog.com/extracting-ima…

2. How Uber Optimized Cassandra Operations At Scale

uber.com/en-CH/blog/how…

3. How Discord Stores Billions of Messages

discord.com/blog/how-disco…
Dec 3, 2024 4 tweets 1 min read
Caching systems play a critical role in keeping databases safe.

But what do you do if all the cache entries expire at the same time?

This kind of thing, known as a cache avalanche, leads to system crashes or degradation.

There are a few strategies you can use to mitigate the risks: ↓Image 1. Different expire dates

You can add a random number to the TTL that is associated with each cache entry.

This approach spreads out the expiration times of cached entries, making it less likely that a lot of them will expire at the same time.
Nov 30, 2024 7 tweets 2 min read
Data structures fall into one of two neat categories:

- linear, like arrays and linked lists

- non-linear, like graphs and tree

Each group has benefits and downsides.

Many developers think they're familiar with such trade-offs, but they are more subtle than they seem.

Here are the 5 key points you need to keep in mind: ↓Image 1. Arrangement of elements

• Linear: the elements are linked sequentially and can be moved through in a single run

• Non-linear: the elements are linked in a hierarchy and set up at different levels
Nov 27, 2024 13 tweets 4 min read
To become a skilled software engineer, you need to master the fundamentals.

You stand out if you know algorithms, distributed systems, and system design.

Here are 11 curated articles that will help you learn new things and get better: ↓ Image 1. The fallacies of distributed systems

Eight distributed systems fallacies that are underrated during system design.

newsletter.francofernando.com/p/the-fallacie…
Nov 20, 2024 10 tweets 4 min read
If you want to become a well-rounded software developer, read these 8 books:↓ 1. The Pragmatic Programmer by Andrew Hunt and David Thomas

It'll teach you how to improve the development process in a pragmatic way.

The book uses analogies and short stories to present development methodologies and what not to do. Image
Nov 9, 2024 5 tweets 2 min read
Don't go to a coding interview without knowing the difference between:

- Generic Trees
- Binary Trees
- Binary Search Trees

Here is all that you need to know:

[1/3] ↓ Image 1. Tree

• It is a hierarchical data structure representing relationships between different elements

• Each element is called "Node" and there is a special element called "Root Node"

• All the nodes of the tree can be accessed starting from the Root Node

• A tree is also a recursive data structure

• Each child node can be the Root of another tree known as its "Subtree"

• The number of parents of a node is always 1 and is known as its In-Degree

• The number of children of a node can differ and is known as its Out-Degree

• Other special elements in a tree are the nodes without children known as "Leaves"

• In a tree there is only 1 possible path connecting every pair of nodes
Nov 6, 2024 12 tweets 3 min read
If you want to get better at algorithms and data structures, read these 10 articles: ↓ 1. Arrays

All you need to know about the array data structure, including multidimensional and dynamic arrays.

newsletter.francofernando.com/p/arrays
Nov 2, 2024 7 tweets 2 min read
Younger engineers seems to have a hard time understanding concepts like threads, CPUs, and cores.

But I remember feeling the same way before working on embedded systems.

I hope this can help some less experienced folks out there:

[1/6] ↓ Image A thread is a sequence of instructions executed by a processor.

Two decades ago, a single chip had only a processor and one hardware thread.

So, it could only execute one set of instructions at a time.

Nowadays, CPUs can handle multiple threads.

[2/6]
Oct 30, 2024 8 tweets 5 min read
As a senior software engineer, you should read these famous white papers from big tech companies (AWS, Google, Meta,..): ↓ 1. Dynamo: Amazon’s Highly Available Key-value Store

cs.cornell.edu/courses/cs5414…

2. Spanner: Google’s Globally-Distributed Database

static.googleusercontent.com/media/research…

3. Scaling Memcache at Facebook

usenix.org/system/files/c…
Oct 29, 2024 4 tweets 2 min read
They don't ask this question in system design interviews.

But if you work with microservices, you need to know the answer.

How can you deal with tail latency?

Tail latency is when a service has rare high response times.

For example, a service typically responds in 10ms but sometimes takes 100ms.

Such rare high latencies can be very bad for systems with a lot of parts and service calls.

Tail latency can be due to many reasons: resource contention, garbage collection, or network issues.

Take a look at two common ways the front end talks with a microservices system: ↓ {1/4}Image 1. Parallel Fan-Out.

A front end service calls several back-end services at the same time and waits for all of them to reply.

The chance of getting a slow answer goes up as more calls are made at the same time.

This situation means that a slow reaction that was once rare will happen more often.

{2/4}
Oct 26, 2024 7 tweets 2 min read
The API design style determines how your apps talk to each other.

Choosing the right API can have a big effect on how well, quickly, and reliably an application works.

It is essential to pick based on what your application needs, not just what is commonly used.

Here, I compared the most well-known API designs to see what makes each stand out: ↓Image 1. SOAP (Simple Object Access Protocol)

Building web services with this design has been around for a long time.

It can work with different protocols and uses messaging based on XML.

It can use various protocols and messages that are based on XML.

It's mostly used in enterprise apps that need to follow strict rules and formal specs.
Oct 23, 2024 4 tweets 3 min read
9 Leetcode articles that will help you with coding interview preparation: ↓ 1.Two Pointers Patterns:

leetcode.com/discuss/study-…

2. Binary Search Patterns:

leetcode.com/discuss/study-…

3. Dynamic Programming Patterns: leetcode.com/discuss/study-…
Oct 19, 2024 5 tweets 2 min read
What is API pagination?

A lot of times, REST APIs need to return 100+ results.

API pagination is a way to break such data into chunks that are easy to work with.

This improves user experience and reduces server load.

These are the 3 kind of API pagination you need to know: ↓ Image 1. Offset-Based

The API uses two parameters: "offset" determines the position in the dataset, while "limit" specifies the maximum number of data to include on each page.

This approach became popular with apps using SQL, which already have LIMIT and OFFSET as part of the syntax.

Example: GET products?limit=20&offset40

Pros: It's simple to set up and lets you go straight to any page.

Cons: There are performance issues with large OFFSET values. It can cause data to be duplicated or skipped in dynamic datasets.
Oct 16, 2024 11 tweets 3 min read
If you want to become a better senior software engineer, read these 10 articles: ↓ 1. How to have better code reviews in your team.

newsletter.francofernando.com/p/code-reviews
Oct 5, 2024 6 tweets 2 min read
Popular System Design Interview Question:

How to design a URL shortener?

Here is how to answer with a step-by-step approach: ↓ Image 1. Requirements

Functional requirements:

- A user enters a URL and gets back a short URL

- The short URL redirect to the long URL when accessed

- The lifetime of the short URL can be customized

- The usage of the short URL can be tracked for analytics

Non Functional requirements:

- High availability

- Minimal latency for URL redirection

- each short URL shall be unique
Oct 2, 2024 11 tweets 2 min read
If you want to get better at coding interviews, learn these 10 patterns: ↓ 1. Two pointers

Two-pointers are like markers that move through an array or list.

The goal is usually to find items that meet certain conditions.

The pointers can move in different directions depending on the problem.

Problem:

- Squaring a Sorted Array
Sep 30, 2024 4 tweets 2 min read
Hash tables are the most used data structure in software development.

They are essential when quick access to data is critical, and everyone should have a good understanding.

The three main things to know about them are hash functions, how to build a hash table, and how to deal with collisions.

If you still have some gaps, here I made a step-by-step breakdown that will solve any doubt: ↓Image 1. What is a hash function?

A hash function is a function that takes any input and converts it to an integer.

Inputs are called keys and the output integer is always less than a fixed value.

The output is deterministic. The same input is always converted to the same integer.

Using a hash function is possible to convert any type of key to the index of an array.