Arnab Chakraborty has Published 4452 Articles

Program to Find Out the Number of Squares in a Grid in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Dec-2020 06:48:11

401 Views

Suppose we have two values p and q, we have to find the number of unique squares that can be generated from a grid with p rows and q columns in which the points are placed evenly. If the answer is very large return result mod 10^9 + 7. In ... Read More

Program to Find Out the Special Nodes in a Tree in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Dec-2020 06:46:36

412 Views

Suppose we have a 2D list of values called 'tree' which represents an n-ary tree and another list of values called 'color'. The tree is represented as an adjacency list and its root is tree[0].The characteristics of an i-th node −tree[i] is its children and parent.color[i] is its color.We call ... Read More

Program to Find Out if There is a Short Circuit in Input Words in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Dec-2020 06:43:44

64 Views

Suppose we have a list of words. We have to check the given words can be chained to form a circle. A word A can be placed in front of another word B in a chained circle if only the last character of A is identical to the first character ... Read More

Program to Find Out the Amount of Rain to be Caught between the Valleys in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Dec-2020 06:41:37

52 Views

Suppose we have a 2D matrix, where the elements represent the height of a terrain. Let's imagine a situation where it will rain and all the spaces in the valleys get filled up.We have to find out the amount of rain that will be caught between the valleys.So, if the ... Read More

Program to Find Out if an Edge is a Part of a Minimum Spanning Tree in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Dec-2020 06:38:41

339 Views

Suppose we have a 2D matrix named 'edges', that represents an undirected graph. Every item in the matrix 'edges' represents an edge and is of the form (u, v, w). This means nodes u and v are connected and the edge has the weight w. We also have integers a ... Read More

Program to Find Out the Minimum Parsing Tree in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Dec-2020 06:35:50

309 Views

Suppose we have a list of unique and sorted numbers that represent breakpoints in a string. We want to create a tree out of these rules −There are nodes that have a value (a, b) where a and b are breakpoints. This means the node spans from indices [a, b] ... Read More

Program to Find Out the Minimal Submatrices in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Dec-2020 06:31:53

195 Views

Suppose we have a 2D matrix and another value k. Our goal is to return a matrix that contains the lowest values of all k x k sub-matrices.So, if the input is like3568654312and k =2, then the output will be [[3, 5], [3, 3]] .From the input, we can see ... Read More

Program to find sum of widths of all subsequences of list of numbers in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Dec-2020 06:29:06

81 Views

Suppose we have a list of numbers called nums, The width of a sequence of numbers as the difference between the maximum and minimum number in the sequence. We have to find the sum of widths of all subsequences of nums. If the answer is very large then mod the ... Read More

Program to find number of sublists containing maximum and minimum after deleting only one element in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Dec-2020 06:27:51

153 Views

Suppose we have a list of numbers called nums and we can delete at most one element in the list. We have to find the maximum number of sublists that contain both the maximum and minimum values of the resulting list.So, if the input is like nums = [3, 2, ... Read More

Program to find size of sublist where product of minimum of A and size of A is maximized in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Dec-2020 06:25:49

86 Views

Suppose we have a list of numbers called nums and another value pos. We have to find a sublist A of nums that includes the index pos such that (minimum of A) * (size of A) is maximized then return the value.So, if the input is like nums = [-2, ... Read More

Advertisements