×
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
Number of leaf nodes in the subtree of every node of an n-ary tree in C++
C++
Server Side Programming
Programming
Hafeezul Kareem
Published on 03-Jul-2021 08:10:52
In this tutorial, we are going to write a program that finds the number of leaf nodes for every node in the n-ary tree.Given a n-ary tree, we have to find the number of leaf nodes for every subtree. Let's see an example.InputN = 8 tree = [[2, 3], [], ...
Read More
Number of leading zeros in binary representation of a given number in C++
C++
Server Side Programming
Programming
Hafeezul Kareem
Published on 03-Jul-2021 08:08:20
Given a number, we have to find the number of leading zeroes in the binary representation of it. Assuming total bits to be 32. Let's see an example.Input5Output25The binary representation of 5 is 00000...00101. The number of leading zeroes are 29.AlgorithmInitialise the number n.Find the binary representation of n.Subtract the ...
Read More
Number of Larger Elements on right side in a string in C++
C++
Server Side Programming
Programming
Hafeezul Kareem
Published on 03-Jul-2021 08:06:11
Given a string, we have to count the number of larger elements on right side of each character. Let's see an example.Inputstring = "abc"Output2 1 0There are 2 larger elements than a on its right side.There is 1 larger element than b on its right side.There are 0 larger elements ...
Read More
Number of integral solutions of the equation x1 + x2 +…. + xN = k in C++
C++
Server Side Programming
Programming
Hafeezul Kareem
Published on 03-Jul-2021 05:33:19
The solutions for the equation areThe number of non-negative integral solutions of the equation are $\left(\begin{array}{c}n-k+1\\ k\end{array}\right)$The number of positive integral solutions of the equation are $\left(\begin{array}{c}k-1\\ n-1\end{array}\right)$Add both to get the required answer. Let's see an example.Inputn = 4 k = 7Output140 AlgorithmInitialise the numbers n and k.Find the ...
Read More
Number of Integral Points between Two Points in C++
C++
Server Side Programming
Programming
Hafeezul Kareem
Published on 03-Jul-2021 05:28:00
In this tutorial, we are going to write a program the finds the number of integral points between the given two points.The number of points between two given points will be gcd(abs(x2), abs(y1-y2)) - 1.If the line joining is parallel to x-axis, then the number of integral points will be ...
Read More
Number of integers with odd number of set bits in C++
C++
Server Side Programming
Programming
Hafeezul Kareem
Published on 03-Jul-2021 05:25:47
Given a number n, we have to find the number of integers with an odd number of set bits in their binary form. Let's see an example.Inputn = 10Output5There are 5 integers from 1 to 10 with odd number of set bits in their binary form.AlgorithmInitialise the number N.Write a ...
Read More
Number of indexes with equal elements in given range in C++
C++
Server Side Programming
Programming
Hafeezul Kareem
Published on 03-Jul-2021 05:23:46
You are given an array, and indexes range. You need to count the total number of adjacent elements that are equal in the given range.Let's see an example.Inputarr = [1, 2, 2, 2, 3, 3, 4] lower = 1 upper = 5Output3AlgorithmInitialise the array and indexes range.Write a loop that ...
Read More
Number of Groups of Sizes Two Or Three Divisible By 3 in C++
C++
Server Side Programming
Programming
Hafeezul Kareem
Published on 03-Jul-2021 05:21:09
Given an array of numbers, we need to find the number of groups of size 2 and 3 that are divisible by 3. We can get the sums of two and three combination numbers and check whether they are divisible by 3 or not.Let's see an example.Inputarr = [1, 2, ...
Read More
Number of groups of magnets formed from N magnets in C++
C++
Server Side Programming
Programming
Hafeezul Kareem
Published on 03-Jul-2021 05:17:30
The digit 1 represent positive pole whereas 0 represents negative pole.The magnet will have both poles as 10 or 01. A group can be formed with the magnets that attracts each other. The magnets with different pole facing each other will be in the same group.Here, you are given N ...
Read More
Number of flips to make binary string alternate - Set 1 in C++
C++
Server Side Programming
Programming
Hafeezul Kareem
Published on 03-Jul-2021 05:16:12
Let's say you have given a binary string "10011". To make an alternate binary string, we need to flip a minimum of 2 characters as "10101".There are two possibilities for the alternate string. It will start with 0 or 1. We will check for two alternates and count the number ...
Read More
Previous
1
2
3
4
5
6
7
...
39
Next
Advertisements
Print
Add Notes
Bookmark this page
Report Error
Suggestions
Save
Close
Dashboard
Logout