Arnab Chakraborty has Published 3734 Articles

Check if a key is present in every segment of size k in an array in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-Aug-2020 13:23:50

205 Views

Suppose we have an array A with N elements, we have another value p and a segment size k, we have to check whether key p is present in every segment of size k in A.So, if the input is like A = [4, 6, 3, 5, 10, 4, 2, ... Read More

Check if a given Binary Tree is Heap in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-Aug-2020 13:13:42

655 Views

Suppose we have a binary tree; we have to check whether it is heap or not. The heap has following property: Heap will be a binary tree That tree should be a complete tree (So. all levels except last should be full). Every nodes value of that tree should be ... Read More

Check if a given Binary Tree is height balanced like a Red-Black Tree in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-Aug-2020 13:09:19

199 Views

Suppose there is a Red-Black Tree, here the largest height of a node is at most double the minimum height. If we have a binary search tree, we have to check the following property. With respect of every node, length of the longest leaf to node path has not more ... Read More

Check for balanced parentheses in an expression O(1) space O(N^2) time complexity in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-Aug-2020 13:04:35

526 Views

Suppose we have a string str containing these brackets '(', ')', '{', '}', '[' and ']', we have to check whether brackets are balanced or not. We can say brackets are balanced when Opening and closing bracket types are of same type. Brackets are closed in correct order.So, if the ... Read More

Find the Largest Cube formed by Deleting minimum Digits from a number in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-Aug-2020 12:59:58

207 Views

Suppose we have a number N, we have to determine the largest perfect cube that can be generated by removing minimum digits (possibly 0) from the number. We can delete any digit from the given number to reach the target. As we know a number N is called a perfect ... Read More

Find the largest Complete Subtree in a given Binary Tree in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-Aug-2020 12:56:20

339 Views

Suppose we have a Binary Tree; we have to find the size of maximum complete sub-tree in this Binary Tree. As we know a complete binary tree is a Binary Tree if all levels are completely filled without possibly the final level and the final level has all keys as ... Read More

Find a pair from the given array with maximum nCr value in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-Aug-2020 12:50:19

239 Views

Suppose we have an array arr with n integers, we have to find arr[i] and arr[j] from the array such that arr[i]Carr[j] is at large as possible. If there is more than one pair, return any one of them.So, if the input is like [4, 1, 2], then the output ... Read More

Minimum removals from array to make GCD Greater in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-Aug-2020 12:45:31

249 Views

Suppose we have a list of N numbers; we have to find the minimum number of removal of numbers are required so that the GCD of the remaining numbers is larger than initial GCD of N numbers.So, if the input is like [6, 9, 15, 30], then the output will ... Read More

What happens when a virtual function is called inside a non-virtual function in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-Aug-2020 12:43:40

357 Views

In this section we will discuss about interesting facts about virtual classes in C++. We will see two cases first, then we will analyze the fact.At first execute the program without using any virtual function.The execute the program using any virtual function under non-virtual function.ExampleLet us see the following implementation ... Read More

Find three element from different three arrays such that that a + b + c = sum in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-Aug-2020 12:41:39

245 Views

Suppose we have three arrays A, B, C and another value called "sum", We have to check whether there are three elements a, b, c such that a + b + c = sum and a, b and c should be under three different arrays.So, if the input is like ... Read More

Advertisements