Arnab Chakraborty has Published 4293 Articles

Pizza With 3n Slices in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 09-Jun-2020 07:07:44

329 Views

Suppose there is a pizza with 3n slices of varying size, I and my two friends will take slices of pizza as follows −I shall pick any pizza slice.My friend Amal will pick next slice in anti clockwise direction of my pick.My friend Bimal will pick next slice in clockwise ... Read More

Longest Happy Prefix in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 09-Jun-2020 07:05:27

1K+ Views

Suppose we have a string s, we have to find the longest happy prefix of s. A string is called a happy prefix if is a non-empty prefix which is also a suffix (excluding itself). If there is no such happy prefix, then simply return blank string.So, if the input ... Read More

Maximum Performance of a Team in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 09-Jun-2020 07:00:46

265 Views

Suppose there are n engineers. They are numbered from 1 to n and we also have two arrays: speed and efficiency, here speed[i] and efficiency[i] represent the speed and efficiency for the ith engineer. We have to find the maximum performance of a team composed of at most k engineers. ... Read More

Frog Position After T Seconds in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 09-Jun-2020 06:59:41

363 Views

Suppose we have one undirected tree consisting of n vertices. The vertices are numbered from 1 to n. Now a frog starts jumping from the vertex 1. The frog can jump from its current vertex to another non-visited vertex if they are adjacent, in one second. The frog can not ... Read More

Maximum Sum BST in Binary Tree in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 09-Jun-2020 06:56:02

441 Views

Suppose we have a binary tree root, we have to find the maximum sum of all nodes of any subtree which is also a Binary Search Tree (BST).So, if the input is like, then the output will be 20, this is the sum of all nodes in the selected BST.To ... Read More

Largest Multiple of Three in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 09-Jun-2020 06:53:06

157 Views

Suppose we have one array of digits, we have to find the largest multiple of three that can be formed by concatenating some of the given digits in any order as we want. The answer may be very large so make it as string. If there is no answer return ... Read More

Count All Valid Pickup and Delivery Options in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 08-Jun-2020 11:41:30

212 Views

Suppose we have a list of n orders, in each order there are pickup and delivery services. We have to count all valid pickup/delivery possible sequences such that delivery[i] is always after the pickup[i]. As the answer may very large, we will return it modulo 10^9 + 7.So, if the ... Read More

Construct Target Array With Multiple Sums in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 08-Jun-2020 11:38:27

142 Views

Suppose we have an array of integers target. From a starting array A consisting of all 1's, we can perform the following procedure −Consider x be the sum of all elements currently in our array.Choose index i, in range 0 to n, where n is the size of the array ... Read More

Jump Game IV in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 08-Jun-2020 11:37:44

346 Views

Suppose we have an array of integers called arr. We are initially at index 0. In one step we can jump from index i to i + x where: i + x < n. i - x where: i - x >= 0. j where: arr[i] and arr[j] are same ... Read More

Jump Game V in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 08-Jun-2020 11:34:51

622 Views

Suppose we have an array of integers called arr and an integer d. In one step we can jump from index i to −i + x where: i + x < n and x in range 1 to d.i - x where: i - x >= 0 and x in ... Read More

Advertisements