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....

October 20, 2024 · 10 min

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:...

July 17, 2024 · 4 min

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 ....

May 3, 2024 · 4 min

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....

April 30, 2024 · 7 min
First to the key first to the egg

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....

February 28, 2024 · 6 min

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....

December 2, 2023 · 6 min
An AI generated image of asteroids

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....

November 20, 2023 · 6 min
Multiple envlopes along with their width and height

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....

November 12, 2023 · 4 min

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?...

November 11, 2023 · 10 min

Tips for post creation

This is the 1st post of “Everything I learned from blogging with Hugo” series I started blogging in Dec 2021. It’s been a wonderful journey. Has enabled me to gather my thoughts in a far more structured way. The series is based on my setup of Hugo - Netlify - GitHub. I’ll shared my knowledge in terms of Hugo knowledge, how to write a blog post and more. If anyone is interested in the Netlify setup, see Hugo Quick Start then Netlify - Hugo setup....

October 1, 2023 · 10 min