Arnab Chakraborty has Published 3734 Articles

Program to find number of restricted paths from first to last node in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 06-Oct-2021 11:26:05

297 Views

Suppose we have one undirected weighted connected graph. The graph has n nodes and they are labelled from 1 to n. A path from start to end is a sequence of nodes like [z0, z1, z2, ..., zk] here z0 is start node and zk is end node and there ... Read More

Program to find maximum score we can get in jump game in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 06-Oct-2021 11:21:46

761 Views

Suppose we have an array called nums and another value k. We are at index 0. In one move, we can jump at most k steps right without going outside the boundaries of the array. We want to reach the final index of the array. For jumping we get score, ... Read More

Program to find minimum elements to add to form a given sum in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 06-Oct-2021 11:17:31

399 Views

Suppose we have an array called nums and two values limit and goal. The array is special because |nums[i]|

Program to find maximum erasure value in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 06-Oct-2021 11:14:15

215 Views

Suppose we have an array called nums (with positive values only) and we want to erase a subarray containing unique elements. We will get score that is sum of subarray elements. We have to find the maximum score we can get by erasing exactly one subarray.So, if the input is ... Read More

Program to find sum of beauty of all substrings in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 06-Oct-2021 11:12:46

795 Views

Suppose we have a string s. We have to find the sum of beauty of all of its substrings. The beauty of a string is actually the difference in frequencies between the most frequent and least frequent characters. So if the string is "abaacc", then its frequency is 3 - ... Read More

Program to find minimum difference of stone games score in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 06-Oct-2021 11:10:16

286 Views

Suppose we have an array called stones where stones[i] represents the value of the ith stone from the left. Two friends Amal and Bimal re playing a turn based game with these stones and Amal starts first always. There are n stones arranged in a row. Each player can remove ... Read More

Program to check whether number is a sum of powers of three in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 06-Oct-2021 11:07:25

608 Views

Suppose we have a number n, we have to check whether it is possible to represent n as the sum of distinct powers of three or not. An integer y is said to be power of three if there exists an integer x such that y = 3^x.So, if the ... Read More

Program to partitioning into minimum number of Deci- Binary numbers in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 06-Oct-2021 11:06:00

578 Views

Suppose we have a number n in string format. We have to find minimum deci-binary numbers are required, so that whose sum is equal to n. A deci-binary number is a decimal number whose digits are either 0 or 1.So, if the input is like n = "132", then the ... Read More

Program to find maximum width ramp in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 06-Oct-2021 11:04:05

380 Views

Suppose we have an array nums, a ramp is a tuple (i, j) for which i < j and nums[i]

Program to find winner of stone game in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 06-Oct-2021 11:01:28

459 Views

Suppose Amal and Bimal are playing a game and Amal's turn is first. The game is like below −There are n stones in a pile. Each player can take a stone from the pile and receive points based on the position of that stone. Amal and Bimal may value the ... Read More

Advertisements