Server Side Programming Articles

Page 1153 of 2109

Create a linked list from two linked lists by choosing max element at each position in C++ Program

Hafeezul Kareem
Hafeezul Kareem
Updated on 11-Mar-2026 2K+ Views

In this tutorial, we are going to write a program that creates a new linked list from the given linked lists.We have given two linked lists of the same size and we have to create a new linked list from the two linked lists with the max numbers from the two linked lists.Let's see the steps to solve the problem.Write a struct node.Create two linked lists of the same size.Iterate over the linked list.Find the max number from the two linked lists nodes.Create a new node with the max number.Add the new node to the new linked list.Print the new ...

Read More

Count number of ways to reach destination in a Maze in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 624 Views

Given a Maze represented as a row X col matrix in which the obstacle is represented as -1 and a clear cell has value other than -1. The goal is to start from the first cell arr[0][0] and reach the last cell arr[row][col] such that only two moves are allowed:Right move arr[i][j] to arr[i][j+1] and Down move arr[i][j] to arr[i+1][j].Let us understand with examples.Input -  arr[row][col] =  {{0, 0, 0}, {-1, -1, 0}, {0, 0, 0}}Output - Count of number of ways to reach destination in a Maze are: 1Explanation      0    1   2   0    0   ...

Read More

Count numbers in range such that digits in it and it's product with q are unequal in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 236 Views

Given two numbers start and end as range variables and an integer q as input. The goal is to find the numbers within a range such that the number and its product with q have no common digits.If the number is 5 and q is 3 then the product will be 15. Both 5 and 15 have a common digit 5.If the number is 2 and q is 5 then the product will be 10. Both 2 and 10 have no common digit.Let us understand with examples.For ExampleInput -  start = 5, end = 10, q = 2Output - Count ...

Read More

Count Numbers in Range with difference between Sum of digits at even and odd positions as Prime in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 376 Views

Given two numbers start and end as range variables. The goal is to find the count of numbers that lie in this range [start, end] and have a difference of sum of digits at even and sum of digits at odd positions as Prime.That is (sum of digits at even position)-(sum of digits at odd position) = a Prime numberLet us understand with examples.For ExampleInput - start = 230, end = 270Output - Count of Numbers in Range with difference between Sum of digits at even and odd positions as Prime are: 6Explanation -  The number(s) between 230 to 270 ...

Read More

Count of a, b & c after n seconds for given reproduction rate in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 197 Views

Given three numbers 'a', 'b' and 'c' as input. The goal is to find the count/value of 'a', 'b' and 'c' after n seconds such that the rate of reproductions are:-Every a changes to b after every 2 secondsEvery b changes to c after every 5 secondsEvery c changes to 2 a after every 12 seconds.Let us understand with examples.For ExampleInput - n_seconds = 62  a = 1 b = 1 c = 1Output - Count of a after n seconds for given reproduction rate is: 0Count of b after n seconds for given reproduction rate is: 33Count of c after ...

Read More

Count of alphabets whose ASCII values can be formed with the digits of N in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 334 Views

Given a long variable containing a positive number as input. The goal is to find the count of alphabets whose ASCII value digits are present in the digits of the number.Pick any two digits from the number and arrange them in a manner such that they form an ASCII value of English alphabets. ASCII values of A-Z start from 65 to 90 and ASCII values of a-z start from 97 to 122.Total numbers that are to be picked will be 26+26=52.Let us understand with examples.For ExampleInput -  N_digits = 163465Output - Count of alphabets whose ASCII values can be formed with ...

Read More

Count of cells in a matrix which give a Fibonacci number when the count of adjacent cells is added in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 199 Views

Given a matrix [ ][ ] having dimensions as row x col. The goal is to find the count of cells of matrix that meet the given condition:Value of cell matrix [i][j] + no. of adjacent cells to it = a Fibonacci numberNumbers in Fibonacci series:- 0, 1, 1, 2, 3, 5, 8, 13, 21, 43 …..Let us understand with examples.For ExampleInput - matrix[row][col] = {{1, 4, 1}, {2, 0, 1}, {5, 1, 1}Output - Count of cells in a matrix which give a Fibonacci number when the count of adjacent cells is added are: 4Explanation      0    1 ...

Read More

Count of n digit numbers whose sum of digits equals to given sum in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 484 Views

Given a positive number as the number of digits and a sum. The goal is to find all d digit numbers that have sum of digits equal to the input sum. The numbers having leading zeros will not be considered as d digit numbers.The ranges are digits between 1 to 100 and sum between 1 and 500.Let us understand with examples.For ExampleInput - digits = 3, digi_sum = 3Output - Count of n digit numbers whose sum of digits equals to given sum are: 6Explanation - Three digit numbers having sum of digits as 3 are:102, 111, 120, 201, 210, ...

Read More

Count of Numbers in Range where first digit is equal to last digit of the number in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 578 Views

Given a range of numbers between start and end. The goal is to find the count of numbers that have the first digit equal to the last digit and fall in the range [ first, last ].All single digit numbers will be counted if they lie in the range.Let us understand with examples.For ExampleInput - start = 100, end = 200Output - Count of Numbers in Range where first digit is equal to last digit of the number are: 10Explanation -  The numbers will be:101, 121, 131, 141, 151, 161, 171, 181 and 191.Input - start = 1, end = ...

Read More

Count sub-matrices having sum divisible 'k' in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 358 Views

Given a row x col matrix as input. The goal is to find all submatrices within the matrix[row][col] such that the sum of elements of that submatrix is divisible by integer k.If the matrix is mat[3][3] and k is 4 then submatrices will be as shown below:- Let us understand with examples.For ExampleInput - matrix[3][3] = { {1, 1, 1}, {2, 2, 2}, {3, 3, 3} }    k=4Output - Count of sub-matrices having sum divisible 'k' are: 4Explanation -  The submatrices will be as shown in above.Input - matrix[3][3] = { {1, 1, 1}, {2, 2, 2 }, {3, 3, ...

Read More
Showing 11521–11530 of 21,090 articles
Advertisements