Kadane’s Algorithm – Maximum Sum Subarray

The given task in this problem is that we have to find the series of contiguous elements with the maximum sum in any given array. You can find the problem here which is based on this algorithm. Before jumping to the Kadane’s algorithm, we will look the naive solution of this problem, and then we … Read more

Program to Find all Factors of a Number

In this article we will discuss three methods to Find All the Factors of a given Number. The codes provided will be in Python, but same logic can be used to implement in any other language as well. Iterative Program to Find All Factors of a Number This method uses modulus operation(%) to Find All … Read more

Introduction to Recursion

So first, what is a recursion? Well it’s anything that includes itself in its definition. When you yell your name loud at an edge of a valley and hear it echoing, that’s a physical world example of recursion. While programming, we may sometimes write some function that call other ones. But if we include the … Read more

Sieve of Eratosthenes

The name seems to be threatening right? On the contrary, Sieve of Eratosthenes is a technique developed by one of the brilliant Greek Mathematicians, Eratosthenes, to eliminate complex looping multiplications or divisions. This algorithm removes all the numbers that do not meet a specific criterion, hence works like a sieve. This is one of the … Read more

Count Digits in a Number

In this article we will discuss four methods to count the digits in a given number. The codes provided will be in C++, but same logic can be used to implement in any other language. Iterative Solution to Count Digits in a Number This method uses division operation(/) to pluck the digits from a number, … Read more