Posts from C++

C++ program to find Kth permutation Sequence

By Sakshi Singh

Consider two given integers N and K, We have to find the Kth permutation sequence from integer 1 to N using C++. For example, Suppose N=3 and K=4, Now, the order list of permutatio.... Read More

C++ program to calculate the difference between two time periods

By Gagana Gonchikar N

In this tutorial, we’ll learn how to calculate the difference between two given time periods in C++. The time periods should be provided by the user. The user can provide two.... Read More

Calculate Hamming Distance of two binary strings in C++

By Himanshu Raj

In this tutorial, we will learn how to calculate Hamming Distance of two binary strings in C++. Hamming distance is the number of bits positions in which two numbers differ while c.... Read More

C++ program to Count the number of subarrays having given XOR

By Sakshi Singh

In this tutorial, We will learn how to implement an efficient C++ program to count the number of subarrays having the given XOR. Consider an array A[] and a given number B, We have.... Read More

C++ program to Check if a subarray with sum 0 exists or not

By Sakshi Singh

In this tutorial, We will learn how to check and if there exists any subarray with sum equals to zero or not in C++. Implement a C++ program to check if an integer array contains a.... Read More

C++ program to find Shortest unique prefix for each word in an array

By Sakshi Singh

In this tutorial, We’ll learn how to find the shortest unique prefix for every word in an array using C++. Assume that no word from the array is the prefix of the other. This.... Read More

C++ Program to find Largest divisible subset in array

By Sakshi Singh

In this tutorial, We will learn how to return largest divisible subset in an array using C++. A subset is said to be divisible if every pair (subset[i], subset[j]) of subset satisf.... Read More

Search for a range in a sorted array using C++

By Sakshi Singh

In this tutorial, we will learn how to search for a range of an element in the given sorted array in C++. Consider a given sorted array A with possibly duplicate elements. We have .... Read More