Arnab Chakraborty has Published 4293 Articles

Find Indexs of 0 to be replaced with 1 to get longest continuous sequence of 1s in a binary array - Set-2 in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 24-Jul-2020 11:37:24

159 Views

ConceptWith respect of a given array of 0s and 1s, determine the position of 0 to be replaced with 1 to get maximum continuous sequence of 1s. In this case, expected time complexity is O(n) and auxiliary space is O(1).Inputarr[] = {1, 1, 0, 0, 1, 0, 1, 1, 1, ... Read More

Find index i such that prefix of S1 and suffix of S2 till i form a palindrome when concatenated in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 24-Jul-2020 11:33:42

170 Views

ConceptWith respect of given two strings S1 and S2 of equal lengths, our task is to determine an index i such that S1[0…i] and S2[i+1…n-1] give a palindrome when concatenated together. Ithas been seen that if it is not possible to determine such an index then print -1.InputS1 = “pqrsu”, ... Read More

Find if there is a path of more than k length from a source in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 24-Jul-2020 11:28:25

164 Views

ConceptWith respect of a given graph, a source vertex in the graph and a number k(here k indicates the path length of graph between source vertex and destination vertex), our task is to determine if there is a simple path (without any cycle) beginning from given source and ending at ... Read More

Find if neat arrangement of cups and shelves can be made in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 24-Jul-2020 11:23:06

134 Views

ConceptWith respect of given three different types of cups (p[]) and saucers (q[]), and m numberof shelves, determine if neat arrangement of cups and shelves can be made.Now, arrangement of the cups and saucers will be neat if it follows the following rules −According to first rule, no shelf can ... Read More

Find if it is possible to get a ratio from given ranges of costs and quantities in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 24-Jul-2020 11:22:07

103 Views

ConceptWith respect of the given range of cost from lowCost to upCost and range of quantity from lowQuant to upQuant, determine if it is possible to obtain a given ratio r where r=cost/quantity, and lowCost

Find if given vertical level of binary tree is sorted or not in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 24-Jul-2020 11:20:26

130 Views

ConceptWith respect of a given binary tree, our task is to determine if a given vertical level of the binary tree is sorted or not.(With respect of this case, when two nodes are overlapping, verify if they form a sorted sequence in the level they lie.)Input2 / \ 3 6 ... Read More

Find if an undirected graph contains an independent set of a given size in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 24-Jul-2020 11:17:08

163 Views

ConceptWith respect of a given undirected graph, verify if it contains an independent set of size l. If there exists an independent set of size l print ‘Yes’, else print ‘No’. It should be noted that an independent set in a graph is defined as a set of vertices which ... Read More

Find Four points such that they form a square whose sides are parallel to x and y axes in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 24-Jul-2020 11:11:28

1K+ Views

ConceptWith respect of given ‘n’ pair of points, our task is to determine four points so that they form a square whose sides are parallel to x and y axes or else display “No such square”. It should be noted that if more than one square is possible then select ... Read More

Find four missing numbers in an array containing elements from 1 to N in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 24-Jul-2020 11:08:21

169 Views

ConceptWith respect of a given array of unique integers where each integer of the given array lies in the range [1, N], the size of array is (N-4) and no single element is repeated. So, four numbers, from 1 to N, are missing in the array. Determine the 4 missing ... Read More

C++ find four factors of N with maximum product and sum equal to N .

Arnab Chakraborty

Arnab Chakraborty

Updated on 24-Jul-2020 11:06:49

142 Views

ConceptWith respect of a given integer N, our task is to determine all factors of N print the product of four factors of N so that −The sum of the four factors is equal to N.The product of the four factors is largest.It has been seen that if it is ... Read More

Advertisements