Arnab Chakraborty has Published 4293 Articles

C++ program to find minimum possible number of keyboards are stolen

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 06:09:53

563 Views

Suppose we have an array A with n elements. There was an electronic store, where a robbery has done on the last night. All keyboards which were present inside the store were numbered in ascending order from some integer number x. For example, for x=4 and there were 3 keyboards ... Read More

C++ program to find two numbers from two arrays whose sum is not present in both arrays

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 06:06:56

162 Views

Suppose we have two arrays A with n elements and B with m elements. Select some element a form A and some element b from B, such that a + b does not belong to A or B.So, if the input is like A = [3, 2, 2]; B = ... Read More

C++ program to find maximum possible value for which XORed sum is maximum

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 06:04:10

220 Views

Suppose we have two numbers a and b. We have to find the smallest possible value of (a XOR x) + (b XOR x) for some value of x.So, if the input is like a = 6; b = 12, then the output will be 10, because if x = ... Read More

C++ program to find maximum possible value of XORed sum

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 06:03:28

161 Views

Suppose we have an array A with N elements and another value K. For an integer X in range 0 to K, let f(X) = (X xor A[1]) + (X xor A[2]) + ... + (X xor A[N]). We have to find the maximum possible value of f.So, if the ... Read More

C++ program to find minimum number of steps needed to move from start to end

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 06:02:02

760 Views

Suppose we have a coordinate (x, y). On a 2D grid, a robot is at (0, 0) position and want to reach (x, y). It can move up, down, left or right or stay at current cell. It wants to reach destination with as minimum as possible commands. We have ... Read More

C++ program to count at least how many operations needed for given conditions

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 06:00:04

211 Views

Suppose we have an array A with N elements. In each operation, we pick an element and increase or decrease it by 1. We have to find at least how many operations are needed to satisfy following conditions −For every i in range 1 to n, the sum of the ... Read More

C++ program to find permutation for which sum of adjacent elements sort is same as given array

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 05:58:50

224 Views

Suppose we have an array A with n elements. A function F(p) is a sorted array of sums of adjacent elements in p. So F(p) = sort([p1 + p2, p2 + p3, ... pn-1 + pn]). We have a permutation represented in A. We have to find the different permutation ... Read More

C++ program to find smallest and largest number of children in game before start

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 05:57:06

201 Views

Suppose we have an array A with K number of elements. Consider, in a game there are N players and a game master is there. This game has K rounds. In ith round game master announces to form groups with A[i] number of children. Then the remaining children form as ... Read More

C++ program to find number of l-r pairs for which XORed results same as summation

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 05:53:54

119 Views

Suppose we have an array A with N elements. We have to find the number of pairs of integers l and r that satisfies A[l] XOR A[l+1] XOR ... XOR A[r-1] XOR A[r] = A[l] + A[l+1] + ... A[r].So, if the input is like A = [2, 5, 4, ... Read More

C++ program to find how many characters should be rearranged to order string in sorted form

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 05:53:45

186 Views

Suppose we have a string S with n characters. S contains lowercase letters only. We must select a number k in range 0 to n, then select k characters from S and permute them in any order. In this process, the remaining characters will remain unchanged. We perform this whole ... Read More

Advertisements