Arnab Chakraborty has Published 4293 Articles

Program to find number of sublists with sum k in a binary list in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Oct-2021 10:05:13

208 Views

Suppose we have a binary list with 0s or 1s. We also have another input called k, we have to find the number of sublists whose sum is same as k.So, if the input is like nums = [1, 0, 0, 1, 1, 1, 0, 1] k = 3, then ... Read More

Program to find list showing total distance required to move all balls to current position in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Oct-2021 10:02:48

129 Views

Suppose we have a binary list called nums containing only 0s and 1s where a 0 indicates empty cell and 1 indicates the cell is filled by a ball. We have to find a new list of say L, whose size is also same like nums size, where L[i] is ... Read More

Program to balance the direction string so that each direction occurred quarter times in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Oct-2021 09:59:26

450 Views

Suppose we have a string s with four directions "N", "S", "W" and "E" for North, South, West and East respectively. We have to find the size of the shortest substring we can update such that each of the four directions occur n/4 times each, where n is the size ... Read More

Program to check how many queries finds valid arithmetic sequence in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Oct-2021 09:55:51

261 Views

Suppose we have a list of numbers called nums and also have list of queries. Where each query element contains [i, j]. So this query is asking whether the sublist of nums from [i, j] (both inclusive), is an arithmetic sequence or not. So finally we have to find the ... Read More

Program to find maximum number of people we can make happy in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 14-Oct-2021 12:50:52

566 Views

Suppose we have a list customers and another list mood, these two are of same length, we also have another integer k. Now on each minute i, customers[i] number of people come to the store and when mood[i] = 1, it indicates the customers are happy and when mood[i] = ... Read More

Program to check string is palindrome or not with equivalent pairs in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 14-Oct-2021 12:45:51

185 Views

Suppose we have a lowercase alphabet string called s and also have a list of pairs called 'pairs'. Each element in pairs has two strings [a, b] where the character 'a' and 'b' are considered same. If there are two pairs like [a, b] and [b, c], then we can ... Read More

Program to check whether there is any pair of words which are almost same in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 14-Oct-2021 12:38:43

476 Views

Suppose we have a list of lowercase strings called words where each word is of same length. We have to check whether there are two strings that differ only in one character.So, if the input is like words = ["seed", "pick", "lick", "root", "live"], then the output will be True, ... Read More

Program to find probability of getting assigned seat for the last person in an airplane after seat shuffling in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 14-Oct-2021 12:34:31

215 Views

Suppose we have an integer n, that is representing the number of seats in an airplane. Now consider the first passenger has lost his ticket, so he picks a random seat. Now everyone else has their ticket but if their seat is already taken, they will also select an available ... Read More

Program to check final answer by performing given stack operations in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 14-Oct-2021 12:31:53

816 Views

Suppose we have a list of string called ops where each element is any one of these operations like below −A non-negative integer value that will be pushed into a stack"POP" to delete top most element from the stack"DUP" to insert top element again into the stack, to make it ... Read More

Program to count how many swimmers will win the final match in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 14-Oct-2021 12:01:04

370 Views

Suppose we have a list of numbers called nums whose length is n. The elements present in this list are representing the current score of swimmers in a competition. For the final match the first place winner for this current round will get n scores, the second place winner will ... Read More

Advertisements