Arnab Chakraborty has Published 4452 Articles

Program to find out if a linked list is present in a given binary tree in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Oct-2021 12:48:04

137 Views

Suppose we are given a binary tree that has a root node 'root' and a linked list that has a head node 'head'. We have to find out if that linked list exists in that binary tree. If a set of nodes in the tree have links with each other ... Read More

Program to find out the largest sum value of a BST in a given binary tree in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Oct-2021 12:43:31

159 Views

Suppose we are provided a binary tree. We have to find out if there exist binary search trees (BST) in the subtrees of it and find out the sum of the largest BST. To find out the sum, we add the values of each node in that BST. We return ... Read More

Program to find out if a BST is present in a given binary tree in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Oct-2021 12:29:28

106 Views

Suppose we are given a binary tree. We have to find out the largest subtree from the tree that is a binary search tree (BST). We return the root node of the BST.So, if the input is likethen the output will be −To solve this, we will follow these steps ... Read More

Program to find out the k-th smallest difference between all element pairs in an array in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Oct-2021 12:19:45

290 Views

Suppose we are given a list containing several integer numbers. We have to find out the difference between each pair of values in the array and find out the k-th smallest difference number. The index starts at 0 and the value k is given to us as input.So, if the ... Read More

Program to find out the k-th largest product of elements of two arrays in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Oct-2021 12:16:12

169 Views

Suppose we are given two lists, p and q that contain some integer numbers. We have to multiply all the values of these lists and have to find out the k-th largest value from the multiplication results.So, if the input is like p = [2, 5], q = [6, 8], ... Read More

Program to find how many lines intersect in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Oct-2021 12:11:03

397 Views

Suppose we are given a list that contains values in pairs of (m, c). These values represent a line, where y = mx + c. We are also given two values, l, and r. We have to find out the number of the lines that intersect with each other between ... Read More

Program to find out the total number of characters to be changed to fix a misspelled word in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Oct-2021 11:46:14

97 Views

Suppose we are given a list of cities and a list of roads that connect each other. The list 'cities' contain the name of cities that a tour bus visits in order. In the list 'roads' the roads are listed in a (source, destination) order meaning there is a one-way ... Read More

Program to decode a given message in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Oct-2021 10:59:55

839 Views

Suppose we are given an encoded message that is a string of integer numbers. Now, these integer numbers can be mapped to a specific letter in the alphabet. a is mapped to 1, b is mapped to 2, c is mapped to 3, and so on. There is also a ... Read More

Program to find out the cost to merge an array of integers into a single value in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Oct-2021 10:59:29

71 Views

Suppose we are given an array arr that contains n positive integer numbers. We are also given an integer number j. The task we have to perform is to merge j numbers into a single number by adding them. The cost of merging is equal to the addition of the ... Read More

Program to find length of longest repeating substring in a string in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Oct-2021 10:46:49

2K+ Views

Suppose we have a lowercase string s, we have to find the length of the longest substring that occurs at least twice in s. If we cannot find such string, return 0.So, if the input is like s = "abdgoalputabdtypeabd", then the output will be 3, because the longest substring ... Read More

Advertisements