Space is a really huge subject to be covered within a single blog, but with this blog let me introduce you to the really spooky side of the universe. Many of these theories have not been verified scientifically but also haven’t been dismissed yet, so as a cliffhanger I leave it to you guys to decide which one you feel is more relatable and accurate. So let’s start then!!
Today let’s try to look at the famous rotting oranges problem. Before proceeding to the problem it is highly recommended for you to know the basics of the data structure queue and the BFS traversal algorithm. To clear the pre-requisite concepts I would recommend you to go through the following links:
Now that our basic concepts are cleared let us proceed to the problem statement and how to solve the problem!
You are given an
m x n
grid where each cell can have one of three values:
0representing an empty cell,
1representing a fresh orange…
We all know that the eternal universe is considered an ever-expanding ball. But if it is expanding why are those changes not visible?
It’s obvious…because these changes are relative and with any change, there is a change in our frame of reference too. In this article, I plan to go deeper into this thought frame to see what can be considered absolute and what can be considered relative?
Gulliver’s travel is a famous classic which can help us analyze more of this analogy. Gulliver was thought to be a giant by the Lilliputians and after that was thought to be…
Strings are an important concept to cover when it comes to interview-preparation for many companies. In this article, I plan to cover the concepts of string also providing its real-life application along with the solution of a problem on LeetCode based on the above concepts. So let’s get started!
There are two ways to hold a sequence of characters in C++. They are
Remember these both are not the same, the difference lies in the fact that character arrays are of the data type character whereas a string is a class that defines objects that…
Stacks are one of the most common data structures which can be seen to have the most daily life applications. As the term defines stacks can be imagined as a pile of books stacked upon each other. Stacks is a linear LIFO data structure, where the term LIFO defines last in first out. This means the element which is inserted at last will be the first one to go out. This can also be imagined by taking the example of the books pile. If we want to take a book from the middle it will be a little tough to…
Computer science is full of real-life examples. One such example is the linked list. A linked list is a data structure that has nodes attached. Now one may ask what is the difference between a linked list and an array. The difference lies in space consumption. A linked list is a noncontiguous data structure hence it ensures more optimized usage of space than an array. Similar to how an array consists of elements a linked list consists of nodes. Each node is divided into two parts
The data part in a linked list stores the value…
Two pointers is an algorithmic technique used for the optimization of many other algorithmic problems. It can be also told as a subset of the binary search algorithm. We can see two pointers apply when we are passing data from non-privileged to the privileged mode in the OS context, traversing linked lists to find its midpoint, or to reverse a linked list. This makes two pointers an important concept to be covered before we proceed to further topics like linked lists, binary search trees, etc. Let’s understand a little bit more about 2 pointers with a problem from Codeforces.
Binary search is one of the most optimized search methods. It has thousands of applications. Some of the small applications might include searching the following vs follower list on Instagram to find people whom you follow and who don’t follow you back, autocompletion of searches in chrome and other browsers, etc.
Today we are going to look at a clever application of binary search algorithm by solving a problem called “The magnet array problem”.
Given n Magnets which are placed linearly, with each magnet to be considered as of point object. Each magnet suffers force from its left-sided magnets such…
Hey guys, it’s me DiligentCoder with yet another algorithmic article. I'm really sorry for the delay as this was a pretty hectic week, but none the less I’m back with an amazing problem and an even more amazing algorithm to crack the problem. So without any further delay let’s start the discussion.
The problem tells us that we are given a histogram with non zero height bars and zero bars in between ( zero bars in between aren’t necessary) as given in the above figure. The heights of each bar are represented with the help of an array. Assume…