Program for Decimal to Binary Conversion

Given a decimal number as input, we need to write a program to convert the given decimal number into equivalent binary number. Examples: Input :… Read More »

Minimum insertions to form a palindrome with permutations allowed

Given a string of lowercase letters. Find minimum characters to be inserted in string so that it can become palindrome. We can change positions of… Read More »

std::all_of() in C++

The C++ function is defined in <algorithm> library in STL. This function operates on whole range of array elements and can save time to run… Read More »

Skip List | Set 2 (Insertion)

We have already discussed the idea of Skip list and how they work in Skip List | Set 1 (Introduction). In this article, we will… Read More »

Program for Binary To Decimal Conversion

Given a binary number as input, we need to write a program to convert the given binary number into equivalent decimal number. Examples : Input… Read More »

Find four elements that sum to a given value | Set 3 (Hashmap)

Given an array of integers, Check if there exist four elements at different indexes in the array whose sum is equal to a given value… Read More »

std::string::append() in C++

This member function appends characters in the end of string. Syntax 1 : Appends the characters of string str. It Throws length_error if the resulting… Read More »

Calculating Factorials using Stirling Approximation

We are aware of calculating factorials using loops or recursion, but if we are asked to calculate factorial without using any loop or recursion. Yes,… Read More »

Non-decreasing subsequence of size k with minimum sum

Given a sequence of n integers, you have to find out the non-decreasing subsequence of length k with minimum sum. If no sequence exists output… Read More »

Check if both halves of the string have same set of characters

Given a string of lowercase characters only, the task is to check if it is possible to split a string from the middle which will… Read More »

Paper Cut into Minimum Number of Squares | Set 2

Given a paper of size A x B. Task is to cut the paper into squares of any size. Find the minimum number of squares… Read More »

Print Colors in Python terminal

There are several methods to output colored text to the terminal, in Python.The most common ways to do are: Using built-in modules ‘colorama’ module :… Read More »