Arnab Chakraborty has Published 4293 Articles

Check if a number is a Trojan Numbers in Python

Arnab Chakraborty

Arnab Chakraborty

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

149 Views

Suppose we have a number n, we have to check whether n is a Trojan Number or not. As we know that the Trojan Number is a number that is a strong number without a perfect power. A number n is a strong number when for every prime divisor or ... Read More

Where is an object stored if it is created inside a block in C++?

Arnab Chakraborty

Arnab Chakraborty

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

1K+ Views

In this section we will discuss about where the variables and objects are stored in the memory when a C++ program is compiled. As we know, there are two parts of memory in which an object can be stored −Stack − All members that are declared inside block of memory, ... Read More

Check if a line at 45 degree can divide the plane into two equal weight parts in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-Aug-2020 13:29:03

144 Views

Suppose we have n different points (Xi, Yi) in 2D coordinate and each point has a weight Wi, we have to check whether a line at 45 degree can be drawn. So that the sum of weights of points on each side will be same.So, if the input is like[[-1, ... Read More

Check if a king can move a valid move or not when N nights are there in a modified chessboard in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-Aug-2020 13:26:52

403 Views

Suppose we have one infinite chessboard with the same rules as that of chess and if there are N knights coordinates on the infinite chessboard and the king’s coordinate, we have to check whether the King is checkmate or not. The coordinate of infinite board is bounded by large value ... Read More

What happens when more restrictive access is given to a derived class method in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-Aug-2020 13:25:03

119 Views

In this section we will discuss about interesting facts restrictive access of derived class methods in C++. We will see some examples and analyze the output to know more about restrictions of using derived class methods in C++.Example (C++)Let us see the following implementation to get better understanding −#include ... Read More

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

174 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 string is a valid number in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-Aug-2020 13:20:44

751 Views

Suppose we have a string, that holds numeric characters and decimal points, we have to check whether that string is representing a number or not. If the input is like “2.5”, output will be true, if the input is “xyz”, output will be false.To solve this, we will follow these ... Read More

Check if a given Binary Tree is Heap in Python

Arnab Chakraborty

Arnab Chakraborty

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

599 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

148 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

464 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

Advertisements