Arnab Chakraborty has Published 4293 Articles

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

Arnab Chakraborty

Arnab Chakraborty

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

1K+ 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

178 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

399 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

Program to find number of unique people from list of contact mail ids in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 14-Oct-2021 11:37:19

214 Views

Suppose we have a list of mail ids in a constants list. So for each row there may be more than one mail id of same person. The contact i is considered as duplicate when there's any j, where j < i such that contact j shares a common email ... Read More

Program to check words can be found in matrix character board or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 14-Oct-2021 11:31:36

562 Views

Suppose we have a matrix character board. Where each cell is holding a character. We also have a string called target, we have to check whether the target can be found in the matrix by going left-to-right, or up-to-down unidirectional way, or not.So, if the input is likeantsspinlapsWord = “tip”then ... Read More

Program to find maximum profit we can make by holding and selling profit in Python

Arnab Chakraborty

Arnab Chakraborty

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

668 Views

Suppose we have a list of numbers called nums, that is representing stock prices of a company in chronological order. We can buy at most one share of stock per day, but you can hold onto multiple stocks and can sell stocks on any number of days. Return the maximum ... Read More

Program to find minimum time required to complete tasks with k time gap between same type tasks in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 14-Oct-2021 11:06:07

385 Views

Suppose we have a list of integers called tasks where each item represents a different task type, we also have a non-negative integer say k. Each task takes one unit of time to complete and the tasks must be completed in correct order, but we must have k units of ... Read More

Program to find array by swapping consecutive index pairs in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 14-Oct-2021 11:03:24

481 Views

Suppose we have a list of numbers called nums, we have to return the list by swapping each consecutive even indexes with each other, and swapping each consecutive odd indexes with each other.So, if the input is like nums = [8, 5, 3, 4, 8, 9, 3, 6, 4, 7], ... Read More

Program to check two strings can be equal by swapping characters or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 14-Oct-2021 10:35:29

719 Views

Suppose we have two lowercase strings s and t, they are of the same length. We can select one character from s and another from t and swap them. We can do this operation any number of times we want. Finally, we have to check whether it's possible to make ... Read More

Program to check sum of two numbers is up to k from sorted List or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 14-Oct-2021 10:32:25

622 Views

Suppose we have a list of numbers called nums and the elements in nums are sorted in ascending order. We also have another value k, we have to check whether any two elements taken from the list add up to k or not. The numbers can also be negative or ... Read More

Advertisements