# Thoughts on Odisha!

When I met people outside Odisha mostly in north India, believe me, most of them don’t know where exactly Odisha is. They will simply say “ somewhere beside West Bengal”. They are even confused between Odissi & odia . They think Odissi is our mother tongue.

# Solving Coding Problem: Best Time to Buy and Sell Stock

Given an array of integers where the ith integer represents the price of the stock on day i, return the largest possible profit from completing one transaction (i.e. buying 1 share and selling 1 share).
Examples: Given the following prices…

`// Buy on day 1 and sell on day 5 for a profit of 5 - 1 = 4. prices = [1, 2, 3, 4, 5], return 4. // Buy on day 4 and sell on day 9 for a profit of 11 - 1 = 10. prices = [4, 5, 2, 1, 6, 10, 4, 9, 11], return 10…`

# Binary Search: Is this food hot enough for my consumption?

Let’s talk about a classical computer science algorithm and how it can help you avoid getting burned or your jaws mutilated from teeth chattering on a cold morning. It can also help you quickly find words in a dictionary (if you still have one lying around), and solve many other daily life issues with minimal effort.

We’ll use searching a word in a dictionary as an example. Searches often have a “search space”, which are the confinements of where our answer could be. At the beginning, the whole dictionary is our “search space”. Our aim is to keep reducing this…

# INTERNSHIP PROJECT

Hackerrank, 2019.

My friend was drawing on the board while I looked on. We were in different teams, each assigned a project. His program currently took 5 hours to execute. The requirement stated one hour. As the ‘algorithm enthusiast’, I was called for help.

The program was to find the friends of all users in a social network. After explaining the use-case, my friend showed me his approach. I was very determined to find an optimization, hence I did. Immediately.

“An adjacency matrix?! No, use an adjacency list. The execution time will reduce in your case to O(N). Or you…

# Design Reddit: System Design #1

Imagine you’re the engineer responsible for building Reddit from the ground up. Walk me through how you would design the system to support the following functionality:

## Hints

Think about the core components that you’ll need, and then dive deeper into them. What kind of database would you…

# Summing Root To Leaf Numbers

Sum Root to Leaf Numbers is an interesting problem from LeetCode. The problem is of medium difficulty and is about binary trees. This post is an explained solution to the problem.

I assume that you’re familiar with Python and the concept of binary trees. If you’re not, you can read this article to get started.

# Solution: Find the center of the maze

A man starts from the north-west (top-left) corner of the land and begins walking towards the center of it, in a spiral manner. As the man moves, he keeps track of the number of trees growing on each block of land and records the counts on his journal until he reaches his destination. This list of numbers is the key to unlock treasures hidden there.

You need to be faster than him. Satellite imagery has already provided you the count of trees on each block of land. …

# Solution: Two Sum

## You’re given an array of integers. Write a function that returns a pair of numbers such that they sum up to zero.

You can assume there will be exactly 1 solution. Each element in the array can only be used once.

Example:

`Array of integers is [2, 7, 9, -2].The pair that sums up to 0 is (2, -2).`

Input:
A list of numbers, separated by space.

`2 7 9 -2`

Output:
2 numbers from the array that sum up to 0.
We will sort the 2 numbers for you so that you can easily compare with our expected output.

`-2 2`

# Observe

1. For a number A, we want to know if such a number B exists, such that A + B…

# Solution: Pluses and Minuses Coding Problem

You’re given a list of integers and a sum, S.

For example:

`Array: 1 5 3 4 3S: 8`

Insert, in front of each number, 1 of the 2 symbols, `+` or `-`, so that the resulting sum adds up to S.
Write a function that counts all such possibilities.

In the example above, there are 3:

`+1 +5 +3 -4 +3-1 +5 +3 +4 -3-1 +5 -3 +4 +3`

Input: S followed by the list of integers.

Output: The number of possibilities where the sum adds up to S.

`Input:81 5 3 4 3…`

# Solution: Letter Combinations on Phone’s Keypad

## Problem Statement:

In older phones, the keypads are used to type both numbers and letters, as follows:

## S7rthak

Software Engineer @Vedantu, Former Intern @Hackerrank, GSoC @Wikimedia, Codeforces(Expert)

Get the Medium app