Skip to content

Category Archives: Competitive Programming

C++ filter_none edit close play_arrow link brightness_4 code // C++ code #include <iostream> #include <utility> using namespace std;   int main() {     // Declaring the… Read More
Given a binary string str, the task is to check whether the given string follows the below condition or not:  String starts with a ‘1’.… Read More
Give two strings S1 and S2, the task is to check whether string S1 can be made equal to string S2 by reversing substring from… Read More
Given an array arr[] of N positive integers, the task is to find the largest strictly increasing subsequence of arr[] such that the indices of… Read More
Given an integer K and an array arr[] which denotes the amount that can be stolen, the task is to choose a subset of items… Read More
Given an array arr[] of size N and an integer k, our task is to find the length of longest subarray whose sum of elements… Read More
Given an array arr[] of size N and integer Y, the task is to find a minimum of all the differences between the maximum and… Read More
Given a number N and two integers A and B, the task is to check if it is possible to convert the number to 1… Read More
Prerequisites: Policy based data structure, Sliding window technique. Given an array of integer arr[] and an integer K, the task is to find the median… Read More
Given an array arr[] of length N and an integer K, the task is to find the longest subarray with difference between any two distict… Read More
Given a string str and two characters X and Y, the task is to write a recursive function to replace all occurrences of character X… Read More
Given an array arr[] of N integers, the task is to replace each element of Array with their rank in array. The rank of an… Read More
Given three positive integers N, A, and B, the task is to check if it is possible to obtain N by adding or subtracting A… Read More
Given an array arr[] of size N, the task is to find the number of non-empty subsequences from the given array such that no two… Read More
Given an integer N, the task is to find its perfect square root by repeated subtraction only.Examples:    Input: N = 25 Output: 5Input: N =… Read More