Arnab Chakraborty has Published 4293 Articles

Find if array can be divided into two subarrays of equal sum in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 01-Nov-2019 09:54:12

177 Views

Suppose we have an array A. We have to check whether we can split the array into two parts, whose sum are equal. Suppose the elements are [6, 1, 3, 2, 5], then [6, 1], and [2, 5] can be two subarrays.This problem can be solved easily by following these ... Read More

Find frequency of smallest value in an array in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 01-Nov-2019 07:23:53

354 Views

Here we will see how to find the frequency of smallest element in an array. Suppose the array elements are [5, 3, 6, 9, 3, 7, 5, 8, 3, 12, 3, 10], here smallest element is 3, and the frequency of this element is 4. So output is 4.To solve ... Read More

Find Excel column number from column title in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 01-Nov-2019 07:21:57

262 Views

We know that the excel column numbers are alphabetic. It starts from A, and after Z, it will AA, AB, to ZZ, then again AAA, AAB, to ZZZ and so on. So column 1 is A, column 27 is Z. Here we will see how to get the column letter ... Read More

Find elements which are present in first array and not in second in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 01-Nov-2019 07:19:55

169 Views

Suppose we have two arrays A and B. There are few elements. We have to find those elements that are present in set A, but not in set B. If we think that situation, and consider A and B as set, then this is basically set division operation. The set ... Read More

Find elements of array using XOR of consecutive elements in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 01-Nov-2019 07:16:08

324 Views

Consider we have to find a list of n elements. But we have the XOR value of two consecutive elements of the actual array. Also the first element of the actual is given. So if the array elements are a, b, c, d, e, f, then the given array will ... Read More

Find duplicates under given constraints in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 01-Nov-2019 07:13:57

184 Views

Suppose we have a list with 6 different numbers. Only one number is repeated five times. So there are total 10 elements in the array. Find duplicate numbers using only two comparisons. If the list is like [1, 2, 3, 4, 4, 4, 4, 4, 5, 6], so output is ... Read More

Find duplicates in O(n) time and O(1) extra space - Set 1 in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 01-Nov-2019 07:12:01

325 Views

Suppose we have a list of numbers from 0 to n-1. A number can be repeated as many as possible number of times. We have to find the repeating numbers without taking any extra space. If the value of n = 7, and list is like [5, 2, 3, 5, ... Read More

Find cubic root of a number in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 01-Nov-2019 07:07:38

419 Views

Here we will see how to get the cubic root of a number. Suppose a number is say 27, then the cubic root of this number is 3. To solve this problem, we will define our own logic without using some library functions. We will use the binary search approach. ... Read More

Find count of digits in a number that divide the number in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 01-Nov-2019 07:04:38

281 Views

Suppose a number is given. We have to count number of digits of the number which evenly divides the number. Suppose the number is 1012, the result is 3. There are three digits 1, 1, and 2 that evenly divide 1012.To solve this, we will find each digit of the ... Read More

Find closest value for every element in array in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 01-Nov-2019 07:02:04

376 Views

Here we will see how to find the closest value for every element in an array. If an element x has next element that is larger than it, and also present in the array, then that will be the greater value of that element. If the element is not present, ... Read More

Advertisements