Sign in

An IMPOSSIBLE task actually says “I M POSSIBLE”
Image from unsplash.com

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?

Let’s start

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…


Dynamic programming(DP) is an algorithmic technique that is used for the optimization of problems that have a recursive solution. Usually whenever we apply a recursive solution for a problem there exists a problem of overlapping subproblems. This means while recursion breaks down the problem into smaller bits sometimes it calculates the result of the same subproblem again and again even though if the solution was calculated before. This is a result of not storing the results of the subproblems.

This is where dynamic programming holds the advantage. The results of the subproblems are stored in a data structure like 1D…


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!

Concept:

There are two ways to hold a sequence of characters in C++. They are

  1. Using character arrays
  2. Using strings

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

  1. Data part
  2. Pointer part

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.

Eugene…


image from GFG

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…


image from LeetCode

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.

Problem:

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…


Hey guys, it’s me DiligentCoder with yet another article on algorithms this time specifically on bit masking, where I’ll cover some basic concepts and move on to the one algorithm which I had dealt with and found to be really beautiful. Let’s hence proceed to the basics without wasting any further time.

WHAT ARE BITMASKS?

Bitmasks are a small set of boolean values(0 or 1). We all know that integers are stored in the computer as boolean values and not as such as it is. Operations dealing with bitmasks and boolean values are termed as bit manipulation. …


Algorithms are fun

Hey guys! My name is Siddharth also known as DiligentCoder in many coding platforms. I ‘am currently pursuing my bachelors degree in Computer science. Algorithms are tough and that’s what makes it interesting to crack and solve them. I ‘ am currently writing this blog as a complete fresher with only some knowledge in algorithms but at the same time preparing each day and sharing the tough problems encountered over here along with it’s explanation so that everyone around also gets to know about that particular problem and the approach used. …

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