×
Home
Jobs
Tools
Coding Ground
Current Affairs
UPSC Notes
Online Tutors
Whiteboard
Tutorix
Login
Categories
Java
JSP
iOS
HTML
Android
Python
C Programming
C++ Programming
C#
PHP
CSS
Javascript
jQuery
SAP
SAP HANA
Data Structure
RDBMS
MySQL
Mathematics
8085 Microprocessor
Operating System
Digital Electronics
Analysis of Algorithms
Mobile Development
Front End
Web Development
Selenium
MongoDB
Computer Network
General Topics
Q/A
Library
eBooks
Courses
Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Selected Reading
UPSC IAS Exams Notes
Developer's Best Practices
Questions and Answers
Effective Resume Writing
HR Interview Questions
Computer Glossary
Who is Who
Hafeezul Kareem
has Published
387
Answers
Next higher number with same number of set bits in C++
C++
Server Side Programming
Programming
Hafeezul Kareem
Published on 01-Jul-2021 06:09:18
We are given a number n, we have to find the number that is greater than n with same number of set bits as n in its binary representation.The digit 1 in the binary representation is called set bit.Let's see an example.Input124Output143AlgorithmInitialise the number n.Write a function get the count ...
Read More
Next higher number using atmost one swap operation in C++
C++
Server Side Programming
Programming
Hafeezul Kareem
Published on 01-Jul-2021 06:03:52
Given a number n, swap any two digits of the number so that the resulting number is greater than the number n. If it's not possible then print -1. Let's see an example.Input12345Output12354We have swapped the digits 4 and 5. And we got the higher number with one swap.AlgorithmIt's not ...
Read More
Next greater Number than N with the same quantity of digits A and B in C++
C++
Server Side Programming
Programming
Hafeezul Kareem
Published on 01-Jul-2021 05:59:49
Given N, A, and B. Find the number which is greater than N with the same number of A and B digits. Let's see an example.N = 1234 A = 2 B = 3We need to check for every possibility of the given number of digits. There are two digits to form ...
Read More
Next greater integer having one more number of set bits in C++
C++
Server Side Programming
Programming
Hafeezul Kareem
Published on 01-Jul-2021 05:57:01
We are given a number n, we have to find the number that is greater than n with one more set bit than n in its binary representation.The digit 1 in the binary representation is called set bit.Let's see an example.Input124Output125AlgorithmInitialise the number n.Write a function get the count of ...
Read More
Next Greater Element in C++
C++
Server Side Programming
Programming
Hafeezul Kareem
Published on 01-Jul-2021 05:44:47
The next greater element is the element that is first greater element after it. Let's see an example.arr = [4, 5, 3, 2, 1]The next greater element for 4 is 5 and the next greater element for elements 3, 2, 1 is -1 as there is no greater element after ...
Read More
Next greater element in same order as input in C++
C++
Server Side Programming
Programming
Hafeezul Kareem
Published on 01-Jul-2021 05:37:47
The next greater element is the element that is first greater element after it. Let's see an example.arr = [4, 5, 3, 2, 1]The next greater element for 4 is 5 and the next greater element for elements 3, 2, 1 is -1 as there is no greater element after ...
Read More
Newman-Shanks-Williams prime in C++
C++
Server Side Programming
Programming
Hafeezul Kareem
Published on 29-Jun-2021 10:18:10
The newman-shanks-williams prime sequence is as follows1, 1, 3, 7, 17, 41...If we generalise the sequence items, we geta0=1 a1=1 an=2*a(n-1)+a(n-2)AlgorithmInitialise the number n.Initialise the first numbers of the sequence 1 and 1.Write a loop that iterates till n.Compute the next number using the previous numbers.Update the previous two numbers.Return ...
Read More
Nesbitt’s Inequality in C++
C++
Server Side Programming
Programming
Hafeezul Kareem
Published on 29-Jun-2021 10:14:56
The nesbitt's inequality is (a/(b + c)) + (b/(c + a)) + (c/(a + b))>= 1.5, a > 0, b > 0, c > 0Given three number, we need to check whether the three numbers satisfy Nesbitt's inequality or not.We can test whether three number are satisfied nesbitt's inequality or ...
Read More
Neon Number in C++
C++
Server Side Programming
Programming
Hafeezul Kareem
Published on 29-Jun-2021 10:13:01
A neon number is a number where the sum of digits of the square of the number is equal to the number. Let's take an example.n = 9square = 81sum of digits of square = 8 + 1 = 9So, the number 9 is a neon number.We need to check ...
Read More
Nearest prime less than given number n C++
C++
Server Side Programming
Programming
Hafeezul Kareem
Published on 29-Jun-2021 10:11:03
We are given a number n, we need to find the nearest prime number that is less than n. We can find the number easily if we start checking from the n - 1. Let's see some examples.Input10Output7AlgorithmInitialise the number n.Write a loop that iterates from n - 1 to ...
Read More
Previous
1
...
3
4
5
6
7
8
9
...
39
Next
Advertisements
Print
Add Notes
Bookmark this page
Report Error
Suggestions
Save
Close
Dashboard
Logout