Arnab Chakraborty has Published 3734 Articles

Program to find maximum population year using Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-May-2021 14:07:56

647 Views

Suppose we have a table with two columns (birth, death) where each row is representing the birth and death years of the ith person. The population of some year y is the number of people alive during y. The ith person is counted in year y's population when y is ... Read More

Program to find two non-overlapping sub-arrays each with target sum using Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-May-2021 14:07:06

244 Views

Suppose we have an array of arr and another value target. We have to find two non-overlapping sub-arrays of arr where each has sum equal to target. If there are multiple answers, then we have to find an answer where the sum of the lengths of the two sub-arrays is ... Read More

Program to find least number of unique integers after K removals using Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-May-2021 14:06:25

845 Views

Suppose we have an array called nums where only integers are stored. If we have a number k. We have to find least number of unique elements after removing exactly k elements.So, if the input is like nums = [5, 4, 2, 2, 4, 4, 3], k = 3, then ... Read More

Program to find minimum number of days to make m bouquets using Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-May-2021 14:05:42

736 Views

Suppose we have an array with integers called nums, we also have another two values m and k. Now, we need to make m bouquets. To make one bouquet we need k adjacent flowers from the garden. Here the garden consists of n different flowers, the ith flower will bloom ... Read More

Program to make file names unique using Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-May-2021 14:04:55

1K+ Views

Suppose we have an array of n strings called names. We have to make n directories in the file system such that, at the ith minute, we will create a directory with the name names[i]. Two files cannot have the same name, if we enter a duplicate directory name the ... Read More

Program to find the kth factor of n using Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-May-2021 14:04:18

681 Views

Suppose we have two positive values n and k. Now consider we have a list of all factors of n sorted in ascending order, we have to find the kth factor in this list. If there are less than k factors, then return -1.So, if the input is like n ... Read More

Program to find longest subarray of 1s after deleting one element using Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-May-2021 13:58:34

465 Views

Suppose we have a binary array called nums, we can delete one element from it. We have to find the size of the longest non-empty subarray which is containing only 1's in the resulting array. If there is no such subarray, then return 0.So, if the input is like nums ... Read More

Program to find out if two expression trees are equivalent using Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-May-2021 13:56:21

283 Views

Suppose, we are provided two expression trees. We have to write a program that checks the two expression trees and determines if the expression trees generate similar values. The two expression trees are provided to us in an in-order manner and we return a True value if they match, or ... Read More

Program to make a bulb switcher using binary string using Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-May-2021 13:55:18

1K+ Views

Suppose we have n bulbs in a room, these bulbs are numbered from 0 to n-1. We have to arrange them in a row from left to right. Initially, all the bulbs are turned off (0-state). We have to get the configuration represented by given target array 't' where t[i] ... Read More

Program to find number of good leaf nodes pairs using Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-May-2021 13:54:36

353 Views

Suppose we have a binary tree. and another value distance d. A pair of two different leaf nodes are said to be good, when the shortest path between these two nodes is smaller or same as distance d.So, if the input is likeAnd distance d = 4, then the output ... Read More

Advertisements