Arnab Chakraborty has Published 4452 Articles

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

698 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

100 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

327 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

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

Arnab Chakraborty

Arnab Chakraborty

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

2K+ Views

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

Program to find start indices of all anagrams of a string S in T in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 09-Nov-2020 10:51:25

118 Views

Suppose we have two strings S and T, we have to find all the start indices of S's anagrams in T. The strings consist of lowercase letters only and the length of both strings S and T will not be larger than 20 and 100.So, if the input is like ... Read More

Program to find numbers represented as linked lists in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 09-Nov-2020 10:46:03

93 Views

Suppose we have two singly linked list L1 and L2, each representing a number with least significant digits first, we have to find the summed linked list.So, if the input is like L1 = [5, 6, 4] L2 = [2, 4, 8], then the output will be [7, 0, 3, ... Read More

Program to find number of subsequences with i, j and k number of x, y, z letters in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 09-Nov-2020 10:41:06

132 Views

Suppose we have a string s with "x", "y" and "z"s, we have to find the number of subsequences that have i number of "x" characters, followed by j number of "y" characters and followed by k number of "z" characters where i, j, k ≥ 1.So, if the input ... Read More

Program to find next board position after sliding the given direction once in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 09-Nov-2020 10:36:31

121 Views

Suppose we have a 2048 game board representing the initial board and a string direction representing the swipe direction, we have to find the next board state. As we know in the 2048 game, we are given a 4 x 4 board of numbers (some of them are empty, represented ... Read More

Program to convert each element in row and column to zero for zero values in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 09-Nov-2020 10:28:02

389 Views

Suppose we have a 2D matrix of numbers, now for each zero in the given matrix and replace all values in its row and column with zero, and return the final matrix.So, if the input is like matrix, then the output will be matrix as the 0th, 2nd and 3rd ... Read More

Program to check whether given list is in valid state or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2020 12:31:10

286 Views

Suppose we have a list of numbers called nums, we have to check whether every number can be grouped using one of the following rules: 1. Contiguous pairs (a, a) 2. Contiguous triplets (a, a, a) 3. Contiguous triplets (a, a + 1, a + 2)So, if the input is ... Read More

Advertisements