Riya Kumari

Riya Kumari

72 Articles Published

Articles by Riya Kumari

Page 2 of 8

Number of n digit stepping numbers - space optimized solution

Riya Kumari
Riya Kumari
Updated on 05-Jan-2024 293 Views

In this article, we will learn about stepping numbers. We will find the possible number of n digit numbers which are also stepping numbers using several C++ techniques. We will also discuss about the most space optimized solution. Let’s first discuss about stepping numbers. These are such numbers which have adjacent digits in such a way that they all have a difference of 1. For example, 321- each of the adjacent digits (3, 2, 1) have a difference of 1 consecutively. Here, we will be given the value of N and then we have to find the count of all ...

Read More

Number of n digit numbers that do not contain 9

Riya Kumari
Riya Kumari
Updated on 05-Jan-2024 367 Views

Suppose you have a given number N. Now, you want to find those numbers of N digit which do not contain 9. This question can be solved by permutation and combination mathematically. In this article, we will find such numbers and count them using C++. Suppose you have to find 1-digit numbers which do not contain 9. So, these numbers are (0 – 8). There are in total 8 such numbers. Similarly, we have to find the count of N digit such numbers. Here, we will be given the value of N and then we have to find the count ...

Read More

Number of mismatching bits in the binary representation of two integers

Riya Kumari
Riya Kumari
Updated on 05-Jan-2024 467 Views

Binary language is the language of the computers. So, every integer, character or symbols needs to be converted into binary system and vice versa. There is binary representation to all high-level language. In this article, we will discuss about the binary representation of integers. Also, we will find the mismatching bits in the binary representation of two integers. Input Output Scenarios We are given two integers X and Y. The number of mismatching bits in their binary representation is the output. Input: X = 25, Y = 15 Output: 3 Input: X = 6, X = 19 Output: 3 ...

Read More

Number of matches required to find a winner

Riya Kumari
Riya Kumari
Updated on 05-Jan-2024 688 Views

Tournaments can be of various types- single elimination, double elimination, league etc., Suppose you are an organizer and you want to know about how many matches needs to conducted in order to conduct the tournament according to the rules of the game. In this article, we will discuss about different ways to find the number of matches required to find a winner using C++. Understanding the Problem In a single elimination tournament, we have series of matches in which each team or player gets to compete with the other one. In each match, there are two teams or players. The ...

Read More

How to drop fill color to change the image color using HTML and CSS?

Riya Kumari
Riya Kumari
Updated on 20-Nov-2023 1K+ Views

In the world of web development, it's essential to have knowledge about the latest CSS and HTML techniques to add stunning visual effects to a website. One such effect is the "color drop effect, " which allows you to change the color of an image on hover by dropping a fill color on it. With this effect, you can make your website more interactive and engaging for the visitors. In this article, we will guide you through the process of creating a color drop effect using HTML and CSS. So, whether you are a beginner or an experienced web developer, ...

Read More

Number of isosceles triangles in a binary tree

Riya Kumari
Riya Kumari
Updated on 12-Jul-2023 245 Views

A binary tree is a data structure in which each node can have two children (at most). These children are known as left and right child respectively. Suppose we are given a parent array representation using which you have to a create a binary tree. The binary tree may have several isosceles triangles. We have to find the total number of possible isosceles triangles in that binary tree. In this article, we will explore several techniques in C++ to solve this problem. Understanding the Problem You are given a parent array. You have to represent it in the form ...

Read More

Number of full binary trees such that each node is product of its children

Riya Kumari
Riya Kumari
Updated on 12-Jul-2023 203 Views

A full binary tree is a special type of binary tree in which all the parent nodes either have two or no children. In data structures, these kinds of trees are considered as balanced and organized representation. Full binary trees may have a unique feature where each of the parent node is a product of its children. In this article, we will discuss about different methods for counting the number of full binary trees such that each node is product of its children using C++. Input Output Scenarios For example, in the array {1, 5, 3, 4}, we have ...

Read More

Number of jumps required for a thief to cross walls

Riya Kumari
Riya Kumari
Updated on 12-Jul-2023 344 Views

Imagine a prisoner (or thief) wants to escape from a jail. In order to do so, he needs to cross N number of walls of varying lengths. He can climb X feet for each jump. But, since the walls are slippery, he falls down by Y feet after each jump. So, we need to calculate number of jumps required to cross all the walls. In this article, we will explore different C++ techniques to find the number of jumps required to escape the jail. Input Output Scenarios We have different heights of the N walls in the form of ...

Read More

Number of jumps required of given length to reach a point of (d, 0) from origin in 2D plane

Riya Kumari
Riya Kumari
Updated on 12-Jul-2023 228 Views

In this article, we will discuss the possible solution of an exciting analytical question of how many jumps are required to reach a point (d, 0) from the origin in a 2D plane where you have been specified fixed length of jumps. We will use the fixed length of jumps and the target coordinates to find the minimum number of jumps required. Input Output Scenarios Suppose jump length can be a or b while the target point is (d, 0). Then, the given output is the minimum number of jumps required to reach target. Input: a = 7, b ...

Read More

Number of integral solutions for equation x = b*(sumofdigits(x) ^ a)+c

Riya Kumari
Riya Kumari
Updated on 12-Jul-2023 327 Views

Suppose you are given three integral numbers a, b and c and you have an equation x = b* (sumofdigits(x)^a) +c. Here, sumofdigits(x) is the total sum of all the digits in x. To find all the possible integral solutions which satisfy the equation, we will explore various approaches in C++. Input Output Scenarios Given below are values of a, b and c. Different integral solution which satisfies the equation x = b* (sumofdigits(x)^a) +c is given as output. Input: a = 2, b = 2, c = -3 Output: 125, 447, 575 In the above scenario the ...

Read More
Showing 11–20 of 72 articles
« Prev 1 2 3 4 5 8 Next »
Advertisements