Arnab Chakraborty has Published 4293 Articles

Find the frequency of a number in an array using C++.

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Oct-2019 06:35:38

316 Views

Suppose we have an array. There are n different elements. We have to check the frequency of one element in the array. Suppose A = [5, 12, 26, 5, 3, 4, 15, 5, 8, 4], if we try to find the frequency of 5, it will be 3.To solve this, ... Read More

Find the frequency of a digit in a number using C++.

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Oct-2019 06:33:53

2K+ Views

Here we will see how to get the frequency of a digit in a number. Suppose a number is like 12452321, the digit D = 2, then the frequency is 3.To solve this problem, we take the last digit from the number, then check whether this is equal to d ... Read More

Find the first repeated character in a string using C++.

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Oct-2019 06:32:11

2K+ Views

Suppose we have a string; we have to find the first character that is repeated. So is the string is “Hello Friends”, the first repeated character will be l. As there are two l’s one after another.To solve this, we will use the hashing technique. Create one hash table, scan ... Read More

Find the factorial of a number in pl/sql using C++.

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Oct-2019 06:29:26

8K+ Views

In this section, we will see how to find factorial of a number using the PL/SQL. In PL/SQL code, some group of commands is arranged within a block of the related declaration of statements.Factorial of a number is basically multiplication of all integers from 1 to n, where n is ... Read More

Find sum of odd factors of a number using C++.

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Oct-2019 06:27:31

339 Views

In this section, we will see how we can get the sum of all odd prime factors of a number in an efficient way. There is a number say n = 1092, we have to get all factors of this. The prime factors of 1092 are 2, 2, 3, 7, ... Read More

Find sum of even factors of a number using C++.

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Oct-2019 06:22:47

565 Views

In this section, we will see how we can get the sum of all even prime factors of a number in an efficient way. There is a number say n = 480, we have to get all factors of this. The prime factors of 480 are 2, 2, 2, 2, ... Read More

Find original array from encrypted array (An array of sums of other elements) using C++.

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Oct-2019 06:13:30

610 Views

Let us consider we have an array of integers, that array is encrypted array, Suppose the array is A = [10, 14, 12, 13, 11], the original array is B = [5, 1, 3, 2, 4], we can see that each element at index I of A follows this rule: ... Read More

Find one extra character in a string using C++.

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Oct-2019 06:11:33

433 Views

Suppose we have two strings S and T, the length of S is n, and the length of T is n + 1. The T will hold all characters that are present in S, but it will hold one extra character. Our task is to find the extra character using ... Read More

Find number of pairs in an array such that their XOR is 0 using C++.

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Oct-2019 06:09:40

180 Views

Suppose we have an array of n elements; we have to find a number of pairs in the array whose XOR will be 0. The pair (x, y) whose XOR is 0, then x = y. To solve it we can sort the array, then if two consecutive elements are ... Read More

Find number of magical pairs of string of length L in C++.

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Oct-2019 06:07:35

186 Views

Suppose we have two strings str1 and str2, we have to find a number of magical pairs of length L. Two strings will be magical if for every index I, the str1[i] < str2[i]. We have to count a number of pairs since the number is very large, then return ... Read More

Advertisements