Learning from my product peers, TIL if you’re making an impactful change then it’s always good to be able to have logs / metrics / dashboards that help you quantify the impact from the perspective of: Users Engineers Product Managers Company Example if your change causes less errors (or more users down a funnel), then: Previously 2000 users a day were seeing errors, now only 600 see the error....
How Do Binaries work together? What breaks ABI?
For two (dynamic) libraries to work together they need: API compatibility ABI compatibility If you have correct function, parameter names, and are able to access it (it’s not private) then you’re good. The compiler validates if classA is using the correct Programming Interface from classB 👈 API (Application Programming Interface) Example of API usage struct House { var address = Address(streetAddress: "1100 Happy St.") } struct Person { var address = Address("1100 Sad St....
Some vs Any
What problem do some and any solve? var x: Equatable = 10 // Error: Use of protocol 'Equatable' as a type must be written 'any Equatable' var y: Equatable = "10" // Same error You’s think the compiler should let the above compile, it rightfully doesn’t. The compiler can’t know if the associated type of x, matches with the associated type of y. So it just forbids it. Compiler just doesn’t want to be in situation where you’d try something like:...
Hugo Post Formatting Basics
Markdown Your posts can be formatted using markdown syntax. It’s critical to know how it works. It’s super simple. Frontmatter You can add tags: [swift, json, network call] and it will then add the tags to your post. Add showToc: true and will show a table of contents for your post. Hugo automatically takes the first 70 words of your content as its summary and stores it into the ....
Hugo High Level
This is the 2nd post of “Everything I learned from blogging with Hugo” series Why Hugo? Hugo is a Static Site Generator. Key is the word “static”. It means: A static website is made up of one or more HTML webpages that load the same way every time. Static websites contrast with dynamic websites, which load differently based on any number of changing data inputs, such as the user’s location, the time of day, or user actions....
Being First is a Game Changer
If you’re ahead of others, you become people’s go to person. It means more involvement. More challenge and opportunities to grow and network. Being first means you can pave the way for others and be helpful. It’s one of the key traits of a lead. Main Advantages of being first You can set the tone, guidelines that you want others to follow. And not you following others. Often you’re late into some bad architecture....
The effect of direction on recursion and understanding code
Today I’m going to discuss another fun and common challenge. It’s the Longest Common Subsequence a.k.a. LCS. I’ll first focus on discussing a pain point I went through when I was trying to compare the algorithm I deduced on my own vs a few other algorithms I saw online. Our algorithms seemed very similar. Yet different. It made debugging my code based on other code very difficult. This is a very common problem I face when I doing leetcode....
Asteroids Collision
Today we’re solving https://leetcode.com/problems/asteroid-collision/ Imagine if we had the following: 1 5 3 8 6 -> -> <- <- -> Each number represents the size of an asteroid. Each asteroid is either going left or right. Bigger asteroids destroy smaller asteroids. Asteroids with same size both get destroyed. If two asteroids are going in the same direction, they don’t hit each other, because all are going in the same speed....
How Many Envelopes Can You Fit Into Another?
Question: How many envelops can you fit into another? Each envelope has a 2D representation. [4,5] -> width = 4, length = 5 How many envelops can you fit into one another without rotating any envelopes. Bare in mind you can’t fit in two evelopes with same width or height. This is question is very much like a Russian Doll question. Which that question itself uses an Longest increasing subsequence algorithm to solve....
Longest Increasing Subsequence Length
Attention: This post was updated to include the alternate solution that uses binary search. It reduces the Time Complexity from O(n * n) to O(n * log n). Before we present the question. Let’s figure out what a subsequence is: What’s a subsequence? Any selection of items from the original array. The selection must respect the order. Meaning for [1,2,3,4,5] only two of the four below are subsequences: [1,2,3,4,5] ✅ [1,4,3,2,5] ❌ order not respected [1,2,5] ✅ [5,1] ❌ order not respected What’s the difference between a subsequence and a subarray?...