Arnab Chakraborty has Published 4452 Articles

Program to find Reordered Power of 2 in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 06-Oct-2021 11:41:39

103 Views

Suppose we have a positive integer N, we reorder the digits in any order (including the original order) such that the leading digit is non-zero. We have to check whether we can do this in a way such that the resulting number is a power of 2.So, if the input ... Read More

Program to find maximum binary string after change in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 06-Oct-2021 11:38:27

344 Views

Suppose we have a binary string. We can apply each of the following operations any number of times −If the number contains a substring "00", we can replace it with "10".If the number contains a substring "10", we can replace it with "01".Then we have to find the maximum binary ... Read More

Program to find maximum average pass ratio in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 06-Oct-2021 11:35:13

131 Views

Suppose we have a list of classes where classes[i] represents [pass_i, total_i] represents the number of students passed the examination of ith class and total number of students of the ith class respectively. We also have another value extra. This indicates extra number of brilliant students that are guaranteed to ... Read More

Program to find average waiting time in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 06-Oct-2021 11:33:56

564 Views

Suppose we have an array customers, where customers[i] = holds a pair [arrival_i, time_i], here arrival_i is the arrival time of the ith customer. And the arrival times are sorted from less to high. And time_i is the time needed to prepare the order of the ith customer. Now, when ... Read More

Program to find center of star graph in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 06-Oct-2021 11:30:49

440 Views

Suppose we have one undirected star graph with n nodes labeled from 1 to n. As we know a star graph is a graph where there is one center node and exactly n - 1 edges that connect the center node with every other node. We have to find the ... Read More

Program to find out number of distinct substrings in a given string in python

Arnab Chakraborty

Arnab Chakraborty

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

613 Views

Suppose, we are given a substring denoted by 's'. We have to find out the unique substrings and return the number of these substrings as output.So, if the input is like s = 'prrstvt', then the output will be 26.The distinct substrings will be −'pr', 'rrs', 'st', 'rr', 'tv', 'rstv', ... Read More

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

187 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

519 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

269 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

107 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

Advertisements