## Number of Transpositions in a Permutation

Permutation A permutation is an arrangement of elements. A permutation of n elements can be represented by an arrangement of the numbers 1, 2, …n… Read More »

- Practice for cracking any coding interview
- How to get rid of Java TLE problem
- How can one become good at Data structures and Algorithms easily?
- Burst Balloon to maximize coins
- Understanding The Coin Change Problem With Dynamic Programming
- Subset array sum by generating all the subsets
- Reach the numbers by making jumps of two given lengths
- Sum of similarities of string with all of its suffixes
- Make all numbers of an array equal
- Maximize the total profit of all the persons
- Some useful C++ tricks for beginners in Competitive Programming
- Find triplets in an array whose AND is maximum
- Check if a number is perfect square without finding square root
- Length of the longest Subarray with only Even Elements
- Print matrix in snake pattern from the last column
- Sort the array of strings according to alphabetical order defined by another string
- Python in Competitive Programming
- Sum of the first N Prime numbers
- How can competitive programming help you get a job?
- How to read Competitive Programming Questions?
- Check if it is possible to reach a number by making jumps of two given length
- Minimum changes required to make two arrays identical
- Number of array elements derivable from D after performing certain operations
- C++: Methods of code shortening in competitive programming
- Sum of the multiples of two numbers below N
- Number of quadrilaterals possible from the given points
- Minimum number of increasing subsequences
- Find two numbers whose divisors are given in a random order
- Minimum number of sets with numbers less than Y
- Smallest Pair Sum in an array

Permutation A permutation is an arrangement of elements. A permutation of n elements can be represented by an arrangement of the numbers 1, 2, …n… Read More »

Given a binary tree, the task is to find the distance between two keys in a binary tree, no parent pointers are given. The distance… Read More »

Given a binary tree where each node can have at most two child nodes, the task is to find the Euler tour of the binary… Read More »

Prerequisite: Time Complexity Analysis Generally, while doing competitive programming problems on various sites, the most difficult task faced is writing the code under desired complexity… Read More »

Given a 3 x n board, find the number of ways to fill it with 2 x 1 dominoes. Example 1 Following are all the… Read More »

Consider a tree with n nodes and root. You can jump from one node to any other node on the same height a maximum of… Read More »

Given an unsigned number, find the minimum number that could be formed by using the bits of the given unsigned number. Examples : Input :… Read More »

Given integers x1, x2, x3……xn, b and m, we are supposed to find the result of ((x1*x2….xn)/b)mod(m). Example 1 : Suppose that we are required… Read More »

Find the number of digits in the nth number constructed by using 6, 1, 4 and 9 as the only digits in the ascending order.… Read More »

Given an array of n positive integers, write a program to find the maximum sum of increasing subsequence from prefix till i-th index and also… Read More »

Prerequisite :Basic knowledge of STL and Sets Data structure. About ordered set Ordered set is a policy based data structure in g++ that keeps the… Read More »

Given a string s we have to find the length of the longest substring of s which contain exactly K distinct vowels. Note: Consider uppercase… Read More »

Given two arrays of same size, we need to convert the first array into another with minimum operations. In an operation, we can either increment… Read More »

Given an array of even number of elements, form groups of 2 using these array elements such that the difference between the group with highest… Read More »

Given an array and a value k. We have to find the maximum number of equal elements possible for the array so that we can… Read More »