# Category Archives: Algorithm

## Python | Sort a List according to the Length of the Elements

In this program, we need to accept a list and sort it based on the length of the elements present within. Examples: Input : list… Read More »

## Find n-th term of series 1, 3, 6, 10, 15, 21…

Given a number n, find the n-th term in the series 1, 3, 6, 10, 15, 21… Examples: Input : 3 Output : 6 Input… Read More »

## Find the sum of the series 1+11+111+1111+….. upto n terms

Here we are going to find the sum of the series 1 + 11 + 111 + 1111 +…..upto N terms (where N is given).… Read More »

## Print powers using Anonymous Function in Python

Prerequisite : Anonymous function In the program below, we have used anonymous (lambda) function inside the map() built-in function to find the powers of 2.… Read More »

## Minimum De-arrangements present in array of AP (Arithmetic Progression)

Given an array of n-elements. Given array is a permutation of some Arithmetic Progression. Find the minimum number of De-arrangements present in that array so… Read More »

## Check if a number is divisible by 17 using bitwise operators

Given a number n, check if it is divisible by 17 using bitwise operators. Examples: Input : n = 34 Output : 34 is divisible… Read More »

## Sum of the Series 1 + x/1 + x^2/2 + x^3/3 + .. + x^n/n

This is a mathematical series program where a user must enter the number of terms up to which the sum of the series is to… Read More »

## Minimum cost to make two strings identical by deleting the digits

Given two strings X and Y consisting of only digits ‘0’ to ‘9’. Find minimum cost required to make the given two strings identical. Only… Read More »

## Program for Identity Matrix

Introduction to Identity Matrix : The dictionary definition of an Identity Matrix is a square matrix in which all the elements of the principal or… Read More »

## Implementing a Superellipse

What is a superellipse A superellipse, also known as a Lamé curve after Gabriel Lamé, is a closed curve resembling the ellipse, retaining the geometric… Read More »

## Minimum initial vertices to traverse whole matrix with given conditions

We are given a matrix that contains different values in its each cell. Our aim is to find the minimal set of positions in the… Read More »

## Maximum size subset with given sum

This is an extended version of subset sum problem. Here we need to find size of maximum size subset whose sum is equal to given… Read More »

## Find n-th term in series 1 2 2 3 3 3 4 4 4 4….

Given series 1 2 2 3 3 3 4 4 4 4 …., find n-th term of the series. The “pattern” is obvious. There is… Read More »

## Program to find the minimum (or maximum) element of an array

Given an array, write functions to find minimum and maximum elements in it. Output: Minimum element of array: 1 Maximum element of array: 1234 Time… Read More »

## No of pairs (a[j] >= a[i]) with k numbers in range (a[i], a[j]) that are divisible by x

Given an array and two numbers x and k. Find the number of different ordered pairs of indexes (i, j) such that a[j] >= a[i]… Read More »