Arnab Chakraborty has Published 4452 Articles

Program to find minimum remove required to make valid parentheses in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 07-Oct-2021 12:34:13

267 Views

Suppose we have a string s with parenthesis '(' , ')' and lowercase English characters. We have to delete the minimum number of parentheses ( '(' or ')', from any positions ) so that the resulting parentheses string is valid and have to finally return any valid string. Here the ... Read More

Program to find how many swaps needed to sort an array in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 07-Oct-2021 12:32:03

2K+ Views

Suppose, we have an array called nums and we have to find the number of swaps needed to make nums sorted in any order, either ascending or descending.So, if the input is like nums = [2, 5, 6, 3, 4], then the output will be 2 because initially nums has ... Read More

Program to find numbers with same consecutive differences in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 07-Oct-2021 12:29:23

261 Views

Suppose we have to find an array of size N such that the absolute difference between every two consecutive digits is K. Every number in the answer must not have leading zeros except for the number 0 itself.So, if the input is like N = 4 K = 7, then ... Read More

Program to find maximum value at a given index in a bounded array in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 07-Oct-2021 12:25:44

283 Views

Suppose we have three values, n, index and maxSum. Consider an array called nums we have to find nums[index] and nums satisfies the following conditions −size of nums is nAll elements in n is positive.|nums[i] - nums[i+1]|

Program to find out the number of accepted invitations in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 07-Oct-2021 12:21:32

186 Views

Suppose there are m boys and n girls, and m = n. There is a party incoming, and each boy has to go with a girl to that party. So, the boys invite all the girls and a girl can accept one invitation only. We have to find out the ... Read More

Program to find partition array into disjoint intervals in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 07-Oct-2021 12:18:32

209 Views

Suppose we have an array nums, we have to partition it into two different subarrays called left and right such that −Each element in left subarray is less than or equal to each element in right subarray.left and right subarrays are non-empty.left subarray has the smallest possible size.We have to ... Read More

Program to find maximum number of consecutive values you can make in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 07-Oct-2021 12:14:35

339 Views

Suppose we have an array called coins with n elements, and it is representing the coins that we own. The value of the ith coin is denoted as coins[i]. We can make some value x if we can select some of our n coins such that their values sum up ... Read More

Program to find out the number of pairs of equal substrings in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 07-Oct-2021 12:04:37

275 Views

Suppose we are given two strings, both made of lowercase alphabets. We have to find out the number of quadruples (p, q, r, s) satisfying the given conditions −0

Program to sort out phrases based on their appearances in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 07-Oct-2021 11:59:00

88 Views

Suppose, we are given two lists; 'phrases' that contain a few selected phrases and 'sentences' that contain several sentences that may or may not contain the phrases from the other list. We have to find out if the various phrases in the first list appear in the second list and ... Read More

Program to find out the buildings that have a better view in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 07-Oct-2021 11:52:59

236 Views

Suppose, we are provided with an array that contains the heights of different buildings. The buildings are located on a line, and a building has a better view if it is not obstructed by another taller building. So provided the array containing heights, we have to find out the buildings ... Read More

Advertisements