3 min read
Do you have triskaidekaphobia?
I grew up in India with a diet of basmati rice and superstition. I have seen pedestrians freezing at the sight of a black cat crossing their path for fear of bad luck. Lemon and chilis hang in front of vehicles to ward off bad spirits. I fondly remember numerous advertisements proclaiming protection from evil eyes. Recently I stumbled upon an ad that refreshed my memories...
Continue reading →
superstition
rationalism
python
1 min read
Creating Python AWS lambda layer with Docker
When you develop AWS lambda functions, you might feel the need to install additional `python` libraries. This can be achieved using Lambda layers that can be included in any lambda function...
Continue reading →
docker
aws
python
2 min read
Leetcode - All Divisions With the Highest Score of a Binary Array
You are given a **0-indexed** binary array `nums` of length `n`. `nums` can be divided at index `i` (where `0 <= i <= n`) into two arrays (possibly empty) nums
left and nums
right..
Continue reading →
leetcode
hashmap
array
java
python
1 min read
Course Schedule Leetcode Solution
There are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prerequisites where prerequisites[i] = [a
i, b
i] indicates that you must take course b
i first if you want to take course a
i...
Continue reading →
leetcode
graph
bfs
java
python
1 min read
Remove-all-adjacent-duplicates-in-string-ii Solution
You are given a string s and an integer k, a k duplicate removal consists of choosing k adjacent and equal letters from s and removing them, causing the left and the right side of the deleted substring to concatenate together...
Continue reading →
leetcode
stack
python
java
scala
javascript
2 min read
Lowest Common Ancestor of a Binary Tree
Questions involving the binary tree data structure are very popular in tech interviews, and can be challenging and varied! A binary tree is a data structure consisting of a collection of nodes (starting at a root node), where each node consists of a value (data), together with a directed edges to at most two nodes (the "left child" and "right child"), with the additional conditions that no two edges point to the same node and no edge points to the root. I recently solved an interesting problem on binary tree...
Continue reading →
leetcode
java
python
javascript
scala
1 min read
Ternary String solution Codeforces - 1354B
Ternary string is an interesting problem that could be solved using two pointers techniques. It's a convenient way to keep track of multiple indices. This helps in making decisions based on two values...
Continue reading →
codeforces
two pointers
java
python
3 min read
Coin Change solution leetcode
It's one of the most popular questions on leetcode that seems very easy at first. Coin change is a classic dynamic programming problem. I will proceed with an obvious (albeit wrong) solution and subsequently proceed to an efficient correct solution...
Continue reading →
leetcode
dp
java
python
1 min read
Maximum Subarray
There's an interesting problem I recently solved on leetcode based on dynamic programming. My
Github repository contains list of all problems that I have solved. I often start with a brute force approach without fretting about time complexity. Later I try to improve my algorithm for a better efficient solution...
Continue reading →
leetcode
dp
java
python
3 min read
Getting Started with AWS CDK
Cloudformation service in AWS allows you to describe an entire set of resources required to make a pipeline. The cloudformation template can be described in JSON or YAML format. Updating the cloudformation template was not a pleasant experience. I wanted to discover alternative ways to generate cloudformation template programmatically...
Continue reading →
aws
cdk
cloudformation
typescript
python
2 min read
How to Make(Or Lose) Money in Stocks Part1
Recently I finished watching web-series
Scam 1992. It's based on story of Harshad Mehta, a famous Indian stockbrocker who made fortunes in stocks. Despite his iconic success &
failure, the series rekindled my interest in world of "stocks". I guess the famous dialogue "Risk Hai Toh Ishq Hai" has stuck with me...
Continue reading →
stocks
python
finance
money
google
selenium
1 min read
EnvCommandError in Windows using Poetry
Poetry is a great dependency management tool in python. It's better than managing a flat file like `requirements.txt`. There are also other great tools like pipenv. However I found poetry much simpler in resolving dependencies...
Continue reading →
windows
python
poetry
bug
3 min read
Connect to an Oracle Database using kerberos with python
Jobs failed! Screamed an automatic failure alert in email inbox. Existing python scripts were failing in the server which fetched data from Oracle database. I wondered if the credentials had changed...
Continue reading →
kerberos
projects
python
docker
oracle
database