Sunidhi Bansal has Published 1100 Articles

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 29-Jan-2021 07:52:20

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

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

Sunidhi Bansal

Sunidhi Bansal

Updated on 29-Jan-2021 07:50:39

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

Count number of ways to reach a given score in a Matrix in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 29-Jan-2021 07:50:01

119 Views

Given a square matrix[][] containing non negative numbers as its elements. Also given a variable score. The goal is to count the ways to reach the given score by adding elements from matrix[][] such that only moves allowed are right moves and down moves. Starting from matrix[0][0] only moves can be, ... Read More

Count of Palindromic substrings in an Index range in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 29-Jan-2021 07:49:16

199 Views

We are given a string and a range starting from start till end and the task is to calculate the count of palindromic substring present in a given range. Palindrome strings are those strings which are similar from forward and backward of a string like nitin, aba, etc.For ExampleInput - InputString ... Read More

Count the Number of Binary Search Trees present in a Binary Tree in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 07-Jan-2021 07:03:44

1K+ Views

We are given a binary tree as input. The goal is to find the number of binary search trees (BSTs) present as subtrees inside it. A BST is a binary tree with left child less than root and right child more than the root.For ExampleInputThe tree which will be created ... Read More

Construct Special Binary Tree from given Inorder traversal in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 07-Jan-2021 06:59:43

342 Views

We are given an array arr[] containing the inorder traversal of a binary tree. The goal is to construct a special binary tree from that array. A special binary tree is the one which has root node’s weight greater than the weights of both its left and right children.For ExampleInputint ... Read More

Count pairs in a binary tree whose sum is equal to a given value x in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 07-Jan-2021 06:55:14

157 Views

We are given an integer value and a variable x and the task is to construct the binary tree and find the pairs having sum equals to the given value x.For ExampleInputint x = 5, The tree which will be created after inputting the values is given below −OutputCount of ... Read More

Construct the full k-ary tree from its preorder traversal in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 07-Jan-2021 06:44:20

316 Views

We are given an array arr[] containing the preorder traversal of the k-ary tree in sequence. The goal is to construct the same k-ary tree from it and print its postorder traversal. A full k−ary tree is the one in which the root node has 0 or k children i.e. ... Read More

Count the nodes whose sum with X is a Fibonacci number in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 07-Jan-2021 06:37:55

92 Views

Given a binary tree with weights of its nodes as numbers. The goal is to find the number of nodes that have weights such that the number is a Fibonacci number. Numbers in Fibonacci series are: 0, 1, 1, 2, 3, 5, 8, 13….nth number is the sum of (n−1)th ... Read More

Construct Pushdown automata for L = {a(2*m)c(4*n)dnbm | m,n = 0} in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 07-Jan-2021 06:33:49

438 Views

We are given with a language “L” and the task is to construct a pushdown automata for the given language which explains that the occurrences of character ‘a’ should be doubles the time of occurrence of character ‘b’ and occurrences of character ‘c’ should be quadruples the times of ‘d’ ... Read More

Advertisements