There are n pencils, each having l length. Each can write 4 kilometers. After writing 4 kilometers it has l/4 length. One can join 4 pencils which are having l/4 length and Read more →
C++ Programs
155 postsGiven a number X, and an array of length N containing the N numbers. Find the minimum number of operations required to make X non-positive. In one operation, you can select any Read more →
Given a ‘N*N’ 2d matrix consisting of positive integers, the task is to find the probability of collecting maximum points by moving either up(from {i,j} to {i+1,j}) or right (from {i,j} to Read more →
Imagine a rooted tree ( with root as node 1). Every node is given two values, init value and expected value. Our task is to flip the node value to make the Read more →
Given a number N which is a power of 2. Calculate total number of set bits from 1 to N-1. Examples : Input : N = 8 Output : 12 Explanation : Read more →
An important aspect of competitive coding is analyzing the algorithms because in competitive coding apart from correctness, efficiency of algorithms also matters significantly. One the most important aspect of time complexity analysis Read more →
Given an integer array a[] of size N and a target sum K, subtract a number from each element such that each element becomes X ( if an element is less than Read more →
Given an integer array arr[] (0 < arr[i] < 106) of size N, the task is to find the LCM of unique elements of the array. If there is no unique element Read more →
We have a set of numbers from 1 to N. In one operation we are allowed to replace A and B by rounded up value of (A+B)/2. We can perform this procedure Read more →
Given an array of positive integers you can reshuffle the array and construct a new array on which we can perform operation X on it the elements we receive must be in Read more →