Sudhir sharma has Published 1149 Articles

Find the only different element in an array using C++

sudhir sharma

sudhir sharma

Updated on 11-Feb-2022 11:36:37

240 Views

In this problem, we are given an arr[] of size n. Our task is to find the only different element in an array.There are only two different types of elements in the array. All the elements are the same except one.Let’s take an example to understand the problem, Inputarr[] = ... Read More

Find the one missing number in range using C++

sudhir sharma

sudhir sharma

Updated on 11-Feb-2022 11:31:24

571 Views

In this problem, we are given an arr[] of size n. Our task is to find the one missing number in range.The array consists of all values ranging from smallest value to (smallest + n). One element of the range is missing from the array. And we need to find ... Read More

Maximum occurring character in an input string using C++

sudhir sharma

sudhir sharma

Updated on 11-Feb-2022 11:27:16

6K+ Views

In this problem, we are given an input string of lowercase characters. Our task is to maximum occurring character in an input string.In case of multiple values with the same frequency of occurrence, we need to print lexicographically smaller values.Let’s take an example to understand the problem, Inputstring = “programming”OutputgSolution ... Read More

Find the number of zeroes using C++

sudhir sharma

sudhir sharma

Updated on 11-Feb-2022 11:22:03

1K+ Views

In this problem, we are given a binary array bin[] consisting of only 0’s and 1’s. Our task is to find the number of zeroes.The array is sorted i.e. all 0’s are arranged together after 1’s.Let’s take an example to understand the problem, Inputarr[] = {1, 1, 1, 0, 0, ... Read More

Find the number of solutions to the given equation in C++

sudhir sharma

sudhir sharma

Updated on 11-Feb-2022 11:20:12

452 Views

In this problem, we are given three integer values A, B, C. Our task is to find the number of solutions to the given equation.EquationX = B*Sm(X)^A + Cwhere Sm(X) is the sum of digits of X.We need to count all the values of X such that it satisfies the ... Read More

Find the number of stair steps using C++

sudhir sharma

sudhir sharma

Updated on 11-Feb-2022 11:13:14

288 Views

In this problem, we are given a number N denoting the number of bricks provided to create the stair. Our task is to find the number of stair steps.Using the given bricks, we need to create a stair step. Each step takes one more brick that the last step. And ... Read More

Find the number of Islands Using Disjoint Set in C++

sudhir sharma

sudhir sharma

Updated on 11-Feb-2022 10:58:15

566 Views

In this problem, we are given a 2D binary matrix. Our task is to find the number of islands Using DFS.Island is a ground of 1 or more connected 1’s in the matrix.Let’s take an example to understand the problem, Inputbin[][] = {{ 1 0 0 0}    {0 1 ... Read More

Find the number of islands Using DFS in C++

sudhir sharma

sudhir sharma

Updated on 11-Feb-2022 10:27:51

325 Views

In this problem, we are given a 2D binary matrix. Our task is to Find the number of islands Using DFS.Island is a ground of 1 or more connected 1’s in the matrix.Let’s take an example to understand the problem, Input : bin[][] = {{ 1 0 0 0}   ... Read More

Program to find Nth Even Fibonacci Number in C++

sudhir sharma

sudhir sharma

Updated on 11-Feb-2022 07:17:27

602 Views

In this problem, we are given an integer value N. Our task is to find Nth Even Fibonacci Number.Fibonacci Series generates subsequent number by adding two previous numbers. The Fibonacci series starts from two numbers − F0 & F1. The initial values of F0 & F1 can be taken 0, ... Read More

First X vowels from a string in C++

sudhir sharma

sudhir sharma

Updated on 01-Feb-2022 11:29:38

228 Views

In this problem, we are given string str[] of size N and an integer X. Our task is to create a program to print First X vowels from a string.We will print first X vowels from the string and if less than X vowels are present, print -1.Let's take an ... Read More

Advertisements