sudhir sharma

sudhir sharma

975 Articles Published

Articles by sudhir sharma

Page 25 of 98

Future of Home Automation

sudhir sharma
sudhir sharma
Updated on 01-Feb-2022 3K+ Views

Home Automation is creating new automation technologies for houses that will make them smart using internet-based technologies. These homes/houses that use home automation technologies are smart Homes.This field of home automation is fastly emerging in technology making homes safer and better places to live. These features help users to virtually monitor and control home attributes like lights, entertainment systems, security, climate control, etc.FUTURE OF HOME AUTOMATIONHome Automation is getter popular day by day making it the basic requirement for future homes which will be smart enough to provide the best possible comfort to people. This technology has a lot of ...

Read More

First element that appears even number of times in an array in C++

sudhir sharma
sudhir sharma
Updated on 01-Feb-2022 318 Views

In this problem, we are given an array arr[] consisting of N integer values. Our task is to create a program for finding the first element that appears even number of times in an array. If any element exists that satisfies the condition return it otherwise return -1 denoting false.Let's take an example to understand the problem, Input: arr[] = {2, 3, 7, 2, 3, 6, 4, 1, 2} Output: 3Solution ApproachA simple method to solve the problem is by considering each element of the array one by one and then checking the element's occurrence frequency even and returning the ...

Read More

Frugal Number in C++

sudhir sharma
sudhir sharma
Updated on 01-Feb-2022 181 Views

In this problem, we are given a positive integer N. Our task is to create a program to check whether the given number is a Frugal number or not.FRUGAL NUMBER − A number whose number of digits is strictly greater than the number of digits in the prime factorization of the given number.Example − 625, prime factors of number 625 is 54.The number of digits in 625 is 3.The number of digits in 54 is 2.3 is strictly greater than 2. Hence, 625 is a frugal number.First few frugal number are − 125, 128, 243, 256, 343, 512, 625, etc.Let’s ...

Read More

Flatten a multilevel linked list in C++

sudhir sharma
sudhir sharma
Updated on 31-Jan-2022 598 Views

In this problem, we are given a multilevel linked list. Our task is to create a program to flatten a multilevel linked list.The flattening operation is done in such a way that the first level nodes will occur first in the linked list and then the second level nodes will occur.Multilevel linked list is a multi-dimensional data structure in which every node of the linked list has two link pointers, one a link to the next node and one to the child list with one or more nodes. This child pointer may or may not point to other list nodes.ExampleLet’s ...

Read More

Fizz Buzz Implementation in C++

sudhir sharma
sudhir sharma
Updated on 31-Jan-2022 6K+ Views

In this problem, we will see the implementation and types of Fizz-Bizz problem.Fizz Buzz − it is a simple programming problem in which the programmer changes the occurrence o all multiples of 3 by ‘Fizz’ and all multiples of 5 by ‘Buzz’ in the numbers from 1 to 100.Let’s take an example to understand the problem1, 2, 'Fizz', 4, 'Buzz', 'Fizz' , 7, 8, 'Fizz' , 'Buzz', 11, 'Fizz' , 13, 14, 'Fizz Buzz' , 16, 17, 'Fizz' , 19, 'Buzz', ....Solution ApproachA simple approach to solving the problem is by simply using a loop from 1 to 100. And ...

Read More

Fitting Shelves Problem in C++

sudhir sharma
sudhir sharma
Updated on 31-Jan-2022 413 Views

In this problem, we are given three integer values W, n, m denoting the length of wall W, size of shelves n, and m. Our task is To Create a Program to solve the Fitting Shelves Problem.We need to find a way to fit shelves in such a way that the space left after fitting shelves is minimized. A secondary constrain while solving is the cost of making, the larger shelves are more cost-effective so, we need to give them a priority.The output should be in the following form, Number of n size shelves number of m size shelves space ...

Read More

Find the largest twins in given range in C++

sudhir sharma
sudhir sharma
Updated on 28-Jan-2022 240 Views

In this problem, we are given two values lValue and hValue. Our task is to find the largest twins in given range.Two numbers are said to be twin numbers if both of them are prime numbers and the difference between them is 2.Let's take an example to understand the problem, Input : lValue = 65, rValue = 100 Output : 71, 73Solution ApproachA simple solution to the problem is by looping from rValue - 2 to lValue and checking each pair of i and (i+2) for twins and print the first occurred twin.Another Approach is by finding all prime numbers ...

Read More

Find the largest pair sum in an unsorted array in C++

sudhir sharma
sudhir sharma
Updated on 28-Jan-2022 1K+ Views

In this problem, we are given an arr[] consisting of N unsorted elements. Our task is to find the largest pair sum in an unsorted array.We will find a pair whose sum is the maximum.Let's take an example to understand the problem, Input : arr[] = {7, 3, 9, 12, 1} Output : 21Explanation −Pair with largest sum, (9, 12). Sum = 21 Solution ApproachA simple solution to the problem is by making a pair of maximum and second maximum elements of the array.For this we will initialise the max and secondMax elements of the array with the first and ...

Read More

Find the largest number with n set and m unset bits in C++

sudhir sharma
sudhir sharma
Updated on 28-Jan-2022 213 Views

In this problem, we are given two integer values, n and m. Our task is to find the largest number with n set and m unset bits in the binary representation of the number.Let's take an example to understand the problemInput : n = 3, m = 1 Output : 14Explanation −Largest number will have 3 set bits and then 1 unset bit. (1110)2 = 14Solution ApproachA simple solution to the problem is by finding the number consisting of (n+m) set bits. From this number, toggle off the m bits from the end (LSB). To create a number with (n+m) ...

Read More

Find the Largest number with given number of digits and sum of digits in C++

sudhir sharma
sudhir sharma
Updated on 28-Jan-2022 2K+ Views

In this problem, we are given two integer values, N denoting the count of digits of a number and sum denoting the sum of digits of the number. Our task is to find the largest number with given number of digits and sum of digits.Let's take an example to understand the problem, Input : N = 3, sum = 15 Output : 960Solution ApproachA simple approach to solve the problem is by traversing all N digit numbers from the largest to smallest. The find the digit sum numbers, if it's equal to sum return the number.ExampleProgram to illustrate the working ...

Read More
Showing 241–250 of 975 articles
« Prev 1 23 24 25 26 27 98 Next »
Advertisements