Arnab Chakraborty has Published 4452 Articles

Program to pruning a given binary tree in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2020 12:10:20

238 Views

Suppose we have a binary tree, where every node's value is either a 0 or a 1. We have to find the same tree where every subtree not containing a 1 has been deleted. So if the tree is like −To solve this, we will follow these steps −Define a ... Read More

Program to find minimum distance that needs to be covered to meet all person in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2020 12:08:16

199 Views

Suppose we have a 2D matrix there are few values like below −0 represents an empty cell.1 represents a wall.2 represents a person.Here a person can walk any of these four directions (up, down, left and right). We have to find a cell that is not wall such that it ... Read More

Program to find minimum number of cells it will take to reach bottom right corner in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2020 12:04:30

142 Views

Suppose we have a 2D grid representing a maze where 0 is for empty space, and 1 is the wall. We will start at grid[0, 0], we have to find the minimum number of squares it would take to get to bottom right corner of the grid. If we cannot ... Read More

Program to find spreadsheet column number from the column title in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2020 12:02:35

105 Views

Suppose we have a column title of spreadsheet. We know that the spreadsheet column numbers are alphabetic. It starts from A, and after Z, it will AA, AB, to ZZ, then again AAA, AAB, to ZZZ and so on. So column 1 is A, column 27 is Z. Here we ... Read More

Program to find spreadsheet column title from the column number in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2020 12:00:42

177 Views

Suppose we have a positive integer value; we have to find its corresponding column title as appear in a spread sheet. So [1 : A], [2 : B], [26 : Z], [27 : AA], [28 : AB] etc.So, if the input is like 29, then the output will be AC.To ... Read More

Program to schedule tasks to take smallest amount of time in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2020 11:59:05

164 Views

Suppose we have a list of values called tasks where each different value represents a different task type, and we also have a non-negative integer k. Each task wants one minute to complete, but we must wait k minutes between doing two tasks of the same type. At any time, ... Read More

Program to find number of given operations required to reach Target in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2020 11:57:08

320 Views

Suppose we have two values start and end, we have to find the minimum number of operations needed to convert start to end by using these operations −Decrement by 1Multiply by 2So, if the input is like start = 2, end = 7, then the output will be 3, as ... Read More

Program to check whether given tree is symmetric tree or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2020 11:54:58

179 Views

Suppose we have one binary tree. We have to check whether the tree is symmetric tree or not. A tree will be said to be symmetric if it is same when we take the mirror image of it. From these two trees, the first one is symmetric, but second one ... Read More

Program to check whether two trees can be formed by swapping nodes or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2020 11:50:02

101 Views

Suppose we have two trees, we have to check whether we can transform first tree into second one by swapping any node's left and right subtrees any number of times.So, if the input is likethen the output will be TrueTo solve this, we will follow these steps −que1 := a ... Read More

Program to check whether each node value except leaves is sum of its children value or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2020 11:46:21

238 Views

Suppose we have a binary tree, we have to check whether for every node in the tree except leaves, its value is same as the sum of its left child's value and its right child's value or not.So, if the input is likethen the output will be TrueTo solve this, ... Read More

Advertisements