I’ve always been curious about how extensions were made. After looking through various online resources, I thought I’d give it a go and have fun while making my very first extension.

What I had in mind was an extension I could turn on, and it would manipulate elements on the website that I’m on. This is DOM (Document Object Model) manipulation. I outlined what my targets were going to be and created a simple outline.

The Plan

  • Select all the Image’s on the current website

Here’s a problem that took me a while to figure out an optimal solution.

The First Duplicate Value.

So far, I’ve noticed some techniques that can be applied to data structure and algorithm problems.

For example, the pointer technique, to compare different elements in an array, and creating a hashmap or dictionary (in python), to store checked values.

This problem however, I had to think more creatively and found a way to get an optimized solution that wouldn’t use up more space.

Let’s get started.

The Prompt

Given an array of integers between 1 and n, inclusive, where n is the length…


When I first started learning about code, I always wondered how design patterns came about. Simply speaking, certain solutions would be repeated many times over until it was recognized as a common pattern that can be referenced.

Design patterns are templates that software engineers can use to provide themselves with insight on how to approach a problem or how to create a new solution.

The author of design patterns usually provide documentation. The structure usually consists of:

  • Term: this is the description

The Prompt

Create a function that takes in a non-empty sorted array of integers, creates a Binary Search Tree (BST) from the integers, and returns the root of the BST.

The function should minimize the height of the BST.

The Code

Given a BST class.

We need to create the function, and the logic to get fulfill the requirements of the problem.


Since I’ve been getting deeper into front end development, I thought I’d share a few things I’ve found to be helpful to create optimized code.

Front end developing feels like solving a jigsaw puzzle to me and there are so many moments of confusion when writing code. There are plenty of tools that can help with debugging and many online resources that provide practice to enhance designing skills with HTML and CSS.

Tip 1: Get Picky About CSS

When I started to create web applications, CSS felt odd to me. …


The Prompt

Create a function that takes in a Binary Search Tree (BST), it may be invalid, and returns a boolean value representing whether the BST is valid.

Each BST node has an integer value, a left child node, and a right child node.

A node is valid if it satisfies the BST property: its value is greater than every node to it’s left, and its value is less than every node to its right.

The Code

Let’s start off by initiating the BST class and creating a template for our solution.


The Prompt

There is an algorithms tournament taking place where teams of programmers compete against each other to solve problems as fast as possible. Teams compete in a round robin, where each team faces off against all other teams.

Only two teams compete against each other as a time, for each competition, one team is designated the home team while the other is the away team.

In each competition there’s always one winner and one loser, there are no ties.

A team receives 3 points if it wins and 0 points if it loses. …


I recently created a solution for the three number sum problem in JavaScript, and now that I want to practice my Python, I thought I’d create a similar solution in Python. Let’s begin.

The Prompt

Create a function that takes an array and a target integer that represents the sum. The function should find all triplets in the array that sum up to the target integer.

The numbers should be in ascending order.

If on three numbers sum up to the target integer, then the function should return an empty array.

The Code

First, we’ll be sorting the array and create a variable to…


The Prompt

Given two input strings, (a) and (b), return (true) if two letters in (a) can be swapped so that the result is equal to (b), otherwise return (false).

Note: swapping letters is defined as taking two indices (i) and (j), where (i) is not equal to (j), and swapping the elements at those indices.

Here’s an example:


The Prompt

Create a function that takes an array of at least three integers and returns a sorted array of the three largest integers in the input array.

Note: You cannot sort the input array

The function should return duplicate integers, if necessary. For example:

Input array -> [10, 5, 9, 10, 13]

Output -> [10, 10, 13]

The Code

So we’re given the prompt and the starting code below:

First, we can create a variable to represent the final output array. At this point, the code can’t derive which elements within the input array are the largest, so we’ll initiate our variable with…

Karan S. Chauhan

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store