Arnab Chakraborty has Published 4293 Articles

Program to find number of places are safe when bomb explodes in Python?

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Nov-2020 07:58:13

192 Views

Suppose we have a 2d binary matrix, where 1 represents a bomb and 0 represents an empty cell. When a bomb explodes, all the spaces along on the same row and column are damaged. We have to find the number of spaces we can stand in to not get damaged.So, ... Read More

Program to find minimum possible sum by changing 0s to 1s k times from a list of numbers in Python?

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Nov-2020 07:55:14

138 Views

Suppose we have a list of numbers called nums and another value k. We have to following operation k times: Select any number on the list. In the binary representation of that number, select a bit that is 0 and make it 1. Finally, we have to return the minimum ... Read More

Program to find starting index of the child who receives last balloon in Python?

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Nov-2020 07:50:58

105 Views

Suppose we have n children standing in a circle, and they are waiting to get a balloon. The distribution is carried out starting with the kth child (first at index 0), and giving them a balloon they left the circle. Now every kth child gets a balloon going clockwise until ... Read More

Program to find higher number with same number of set bits as n in Python?

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Nov-2020 07:40:38

193 Views

Suppose we have a number n; we have to find the smallest next higher number with the same number of 1s as n in binary form.So, if the input is like n = 7, then the output will be 11, as 7 in binary is 0111 and next higher from ... Read More

Program to find column index where left most 1 is present in a binary matrix in Python?

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Nov-2020 07:37:30

253 Views

Suppose we have a 2D binary matrix. Here each row is sorted in ascending order with 0s coming before 1s, we have to find the leftmost column index with the value of 1. If there's no such result, return -1.So, if the input is like0001001100110010then the output will be 2, ... Read More

Program to find maximum profit we can make by buying and selling stocks in Python?

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Nov-2020 07:34:52

213 Views

Suppose we have a list of stock prices of a company in chronological order, we have to find the maximum profit we could have made from buying and selling the stock. We must buy before selling, and we must wait one day after selling the stock before buying again.So, if ... Read More

Program to convert linked list by alternating nodes from front and back in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Nov-2020 07:31:39

175 Views

Suppose we have a singly linked list, we have to rearrange it such that we take: the last node, and then the first node, and then the second last node, and then the second node, and so on.So, if the input is like [1, 2, 3, 4, 5, 6, 7, ... Read More

Program to find minimum number of characters to be deleted to make A's before B's in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Nov-2020 07:26:04

899 Views

Suppose we have a string s consisting only two letters A and B, we have to find the minimum number of letters that need to be deleted from s to get all occurrences of As before all occurrences of Bs.So, if the input is like S = "AABAABB", then the ... Read More

Program to find number of ways we can arrange symbols to get target in Python?

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Nov-2020 07:23:28

178 Views

Suppose we have a list of non-negative numbers called nums and also have an integer target. We have to find the the number of ways to arrange + and - in nums such that the expression equals to target.So, if the input is like nums = [2, 3, 3, 3, ... Read More

Program to find number of arithmetic subsequences from a list of numbers in Python?

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Nov-2020 07:19:24

457 Views

Suppose we have a list of numbers called nums, we have to find the number of arithmetic subsequences of length ≥ 3. As we know an arithmetic sequence is a list of numbers where the difference between one number and the next is the same.So, if the input is like ... Read More

Advertisements