Arnab Chakraborty has Published 4293 Articles

Program to Find Out the Minimum Cost to Purchase All in Python

Arnab Chakraborty

Arnab Chakraborty

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

347 Views

Suppose, we have N items, which are marked as 0, 1, 2, …, N-1. Then, we are given a 2D list of size S called sets. Here, we can purchase the i-th set for the price sets[i, 2], and we receive every item between sets[i, 0] to sets[i, 1]. Also, ... Read More

Program to Find Out the Cost after Finding k Unique Subsequences From a Given String in C++

Arnab Chakraborty

Arnab Chakraborty

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

201 Views

Suppose, we have a string s and another value k. We have to select some subsequences of s, so that we can get k unique subsequences. Here, the cost of selecting a subsequence equals the length of (s) - length of (subsequence). So, we have to find the lowest total ... Read More

Program to Find Out the Strings of the Same Size in Python

Arnab Chakraborty

Arnab Chakraborty

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

148 Views

Suppose, we have a string 'i' consisting of lowercase letters and another integer 'j'. We have to find out how many strings there are that are equal to the size of 'i' and are lexicographically smaller or equal to 'i' and having no consecutive equal characters greater than 'j'.The answer ... Read More

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

661 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

552 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

133 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

104 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

438 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

410 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

281 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

Advertisements