Arnab Chakraborty has Published 4452 Articles

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

Arnab Chakraborty

Arnab Chakraborty

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

175 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

394 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

117 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

402 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

158 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

658 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

283 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

Program to check heap is forming max heap or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 14-Oct-2021 11:54:51

979 Views

Suppose we have a list representing a heap tree. As we know heap is a complete binary tree. We have to check whether the elements are forming max heap or not. As we know for max heap every element is larger than both of its children.So, if the input is ... Read More

Program to check all listed delivery operations are valid or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 14-Oct-2021 11:45:32

124 Views

Suppose we have a list of strings called orders. Each element in the orders list starts with either "P" or "D". The "P" indicates that is picked up, and "D" means "delivery". And these letters are followed by the order id number. For example, "P6" indicates pick up order 6. ... Read More

Program to find buildings from where sea can be visible in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 14-Oct-2021 11:42:09

276 Views

Suppose we have a list of heights of different buildings. A building with heights value heights[i] can see the ocean when every building on its right are shorter than that building. We have to find the building indices from where we can see the ocean, in ascending order.So, if the ... Read More

Advertisements