Sudhir sharma has Published 1149 Articles

Find whether a given number is a power of 4 or not in C++

sudhir sharma

sudhir sharma

Updated on 01-Feb-2022 08:09:16

786 Views

In this problem, we are given an integer N. Our task is to find whether a given integer is a power of 4 or not.Let's take an example to understand the problem, Input : N = 64 Output : YesExplanation −43 = 64 Solution ApproachA simple solution to the problem ... Read More

For Versus While in C++

sudhir sharma

sudhir sharma

Updated on 01-Feb-2022 08:04:05

231 Views

Loops in programming are used to compute a block of code multiple times. Here we will be seeing the difference between two types of loops in the program, For Loop and While Loop.For LoopFor Loop is a type of repetition control loop which allows the user to loop over the ... Read More

Find whether a given integer is a power of 3 or not in C++

sudhir sharma

sudhir sharma

Updated on 01-Feb-2022 08:04:05

746 Views

In this problem, we are given an integer N. Our task is to find whether a given integer is a power of 3 or not.Let's take an example to understand the problem, Input : N = 729 Output : YesExplanation −36 = 719 Solution ApproachA solution to the problem is ... Read More

Find value of y mod (2 raised to power x) in C++

sudhir sharma

sudhir sharma

Updated on 01-Feb-2022 08:00:18

203 Views

In this problem, we are given two values x and y. Our task is to find value of y mod (2 raised to power x).Let's take an example to understand the problem, Input : x = 2, y = 19 Output : 3Explanation −y % 2x = 19 % 22 ... Read More

Find value of k-th bit in binary representation in C++

sudhir sharma

sudhir sharma

Updated on 01-Feb-2022 07:31:06

406 Views

In this problem, we are given two values n and k. Our task is to find value of k-th bit in binary representation.Let's take an example to understand the problem, Input : n= 5, k = 2 Output : 0Explanation −Binary of 5 = 0101 Second LSB bit is 0.Solution ... Read More

Find value of (n^1 + n^2 + n^3 + n^4) mod 5 for given n in C++

sudhir sharma

sudhir sharma

Updated on 01-Feb-2022 07:26:40

226 Views

In this problem, we are given a value n. Our task is to find value of (n^1 + n^2 + n^3 + n^4) mod 5 for given n.Let's take an example to understand the problem, Input : n= 5 Output : 0Explanation −(51 + 52 + 53 + 54) mod ... Read More

Future of Home Automation

sudhir sharma

sudhir sharma

Updated on 01-Feb-2022 07:23:07

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 ... Read More

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

sudhir sharma

sudhir sharma

Updated on 01-Feb-2022 07:22:24

239 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 ... Read More

Frugal Number in C++

sudhir sharma

sudhir sharma

Updated on 01-Feb-2022 07:15:58

142 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 ... Read More

Flattening a Linked list in C++

sudhir sharma

sudhir sharma

Updated on 01-Feb-2022 06:41:02

456 Views

In this problem, we are given linked list consisting of two pointer nodes, right and down.Right node is the main linked list pointer.Down node is for secondary linked list starting with that node.All the linked lists are sorted.Our task is to create a program to flatten a linked list and ... Read More

Advertisements