Arnab Chakraborty has Published 4293 Articles

Find pair with maximum GCD in an array in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2019 13:40:07

651 Views

Suppose we have an array of positive integers. Our task is to find pair of integers from the array, where the GCD value is maximum. Let A = {1, 2, 3, 4, 5}, then the output is 2. The pair (2, 4) has GCD 2, other GCD values are less ... Read More

Find Count of Single Valued Subtrees in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2019 13:37:05

443 Views

Suppose we have a binary tree. Our task is to count single valued subtrees in the given tree. A single valued subtree is a subtree, where all nodes of that tree is containing same value. Suppose a tree is like below −There are four Single value subtrees. These are like ... Read More

Find Corners of Rectangle using mid points in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2019 13:33:40

175 Views

Suppose we have a rectangle ABCD, but we have only the coordinates of the mid points P and Q, and the length of the rectangle L.Our task is to find the coordinates of A, B, C and D using the coordinates of P and Q, and the length of side ... Read More

Minimum Index Sum for Common Elements of Two Lists in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2019 13:29:49

200 Views

Suppose two person wants to choose different cities, they have listed out the cities in different list, we have to help the, to find common choices. So we need to find those cities, those are marked by both of them.This operation is very similar to the set intersection property, we ... Read More

Minimum Cost To Make Two Strings Identical in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2019 13:27:13

215 Views

Suppose we have two strings A and B, and another two cost values like CostA, and CostB. We have to find the minimum cost to make A and B identical. We can delete characters from string, the cost for deleting from string A is CostA, and cost for deleting from ... Read More

Minimum Cost to make two Numeric Strings Identical in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2019 13:25:44

164 Views

Suppose we have two numeric strings A and B. We have to find the minimum cost to make A and B identical. We can perform only one operation, that is we can delete digits from string, the cost for deleting a digit from number is same as the digit value. ... Read More

Minimize ASCII values sum after removing all occurrences of one character in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2019 13:20:09

149 Views

Suppose we have a string. We have to minimize the sum of ASCII values, of each character to the string, after removing every occurrence of a particular character. Suppose a string is given like “hello” the sum of ASCII characters is (104 + 101 + 108 + 108 + 111) ... Read More

Median and Mode using Counting Sort in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2019 13:18:44

389 Views

Consider we have an array of size n, we have to find the Median and Mode using the counting sort technique. This technique is useful, when the array elements are in limited range. Suppose the elements are {1, 1, 1, 2, 7, 1}, then the Mode is 1, and Median ... Read More

md5sum Command in Linux with Examples

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2019 13:16:14

548 Views

Here we will see the md5sum command in Linux system. The MD5 is one of the Message Digest algorithm, that generates hash values to create checksum for the messages. It helps to identify if the integrity is maintained or not. Here we will see some example of md5sum command in ... Read More

MCQ on Memory allocation and compilation process in C

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2019 12:52:48

514 Views

Here we will see some MCQ questions on Memory Allocation and Compilation Processes.Question 1 − What will be the output of the following code − Live Demo#include #include int main() {    union my_union {       int i;       float f;       char ... Read More

Advertisements