Introduction While preparing for system design interviews a few months ago, I realized something that caught me off guard: even as an experienced software engineer, my intuition about performance wasn’t as strong as I thought. I know the usual rules of thumb - Cache is fast, Disk is slow, Network calls are expensive. I can recite the latency numbers every programmer is supposed to know, and I’...
My recent adventure at work was an open-ended endeavour to optimize a memory guzzling Go service. The service is a cron job that is scheduled to run on an hourly basis. When it runs, it queries our Postgres DB, fetching a huge amount of data, applies some transformations on each row retrieved and writes the results to a CSV file. The CSV file is then compressed and uploaded to a SFTP server, fr...
This post is inspired by the following StackExchange CodeGolf thread. For the uninitiated, Fizz Buzz is the programming equivalent of a “Hello World” - a simple task used in job interviews to filter out people who can’t code their way out of a paper bag. The challenge: Write a program that prints numbers from 1 to a very high number. For multiples of 3, print “Fizz” instead. For multiples ...
Introduction This Diwali, I came across a festive-themed Apple icon on Apple India’s website, and set out to recreate it. Here’s the original look for reference: Enter SF Symbols SF symbols is a comprehensive library of vector-based symbols that you can incorporate into your app to simplify the layout of user interface elements through automatic alignment with surrounding text, and support f...
This post is a presentation of my attempt to create an iterative way to generate permutations of a string in Swift, similar to C++ STL’s next_permutation function. I got the idea to solve this problem while reading one of the challenges (Challenge 14) in Paul Hudson’s Swift Coding Challenges book. The Algorithm In C++, next_permutation can be called in a loop and will keep generating permutati...