Arnab Chakraborty has Published 4452 Articles

Program to find max number of K-sum pairs in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 06-Oct-2021 10:45:25

461 Views

Suppose we have an array called nums and another value k. In one operation, we can select two elements from nums whose sum is equals to k and remove them from the array. We have to find the maximum number of operations we can perform on the array.So, if the ... Read More

Program to find maximum score in stone game in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 06-Oct-2021 09:45:14

209 Views

Suppose there are several stones placed in a row, and each of these stones has an associated number which is given in an array stoneValue. In each round Amal divides the row into two parts then Bimal calculates the value of each part which is the sum of the values ... Read More

Program to check whether string Is transformable with substring sort operations in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 06-Oct-2021 09:36:07

79 Views

Suppose we have two numeric strings s and t, we want to transform from string s to t using the following operation any number of times: 1. Select a non-empty substring in s and sort it inplace so the characters are in ascending order. We have to check whether it ... Read More

Program to find out if the graph is traversable by everybody in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 06-Oct-2021 09:32:25

127 Views

Suppose, we are given a graph that contains n vertices numbered 0 to n - 1. The graph is undirected and each edge has a weight. The graph can have three types of weights and each weight signifies a particular task. There are two people that can traverse the graph, ... Read More

Program to detect cycles in 2D grid in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 06-Oct-2021 09:27:24

163 Views

Suppose we have one 2D array of characters called grid of size m x n. We have to check whether we can detect a cycle inside it or not. Here a cycle is a path of length 4 or more in the grid that starts and ends at the same ... Read More

Program to find minimum number of days to eat N oranges in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 06-Oct-2021 09:13:33

216 Views

Suppose we have a number n. So consider there are n oranges in the kitchen and we eat some of these oranges every day maintaining these rules: 1. Eat single orange. 2. If n is even, then eat n/2 oranges. 3. If n is divisible by 3 can eat 2*(n/3) ... Read More

Program to find minimum cost to cut a stick in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 06-Oct-2021 09:09:38

648 Views

Suppose we have a value n and an array called cuts. Consider there is a wooden stick of length n units. The stick is labelled from 0 to n. Here cuts[i] represents a position where we can cut. We should perform the cuts in order, but we can change the ... Read More

Program to find longest awesome substring in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 06-Oct-2021 09:06:54

399 Views

Suppose we have a numeric string s. As we know an awesome substring is a non-empty substring of s such that we can make any number of swaps in order to make it palindrome. We have to find the length of the maximum length awesome substring of s.So, if the ... Read More

Program to find the maximum score from all possible valid paths in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 06-Oct-2021 09:00:33

468 Views

Suppose we have two arrays nums1 and nums2. A valid path is defined as follows −Select nums1 or nums2 to traverse (from index-0).Traverse the array from left to right.Now, if we are moving through any value that is present in nums1 and nums2 we can change the path to the ... Read More

Program to find min length of run-length encoding after removing at most k characters in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 06-Oct-2021 08:57:34

140 Views

Suppose we have a string s and another value k. We can delete at most k characters from s such that the length of run-length encoded version of s is minimum. As we know the run-length encoding is a string compression method that replaces consecutive identical characters (2 or more ... Read More

Advertisements