Arnab Chakraborty has Published 3734 Articles

Program to evaluate ternary expression in C++

Arnab Chakraborty

Arnab Chakraborty

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

365 Views

Suppose we have an expression that holds the ternary expression, we have to evaluate the result of the expression. It supports some values like T and F for True and False and “?” and “:” characters. There are some properties:The length of the given string must be less than or ... Read More

Program to check we can update a list index by its current sum to reach target or not in python

Arnab Chakraborty

Arnab Chakraborty

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

161 Views

Suppose we have a list of numbers called target. Now let us consider a list X with the same length as given list and X is filled with 1s. We can perform the following operation as many times as we want: Take any index i in X and set X[i] ... Read More

Program to convert gray code for a given number in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 26-Nov-2020 06:59:12

980 Views

Suppose we have a number n, we have to find the gray code for that given number (in other words nth gray code). As we know the gray code is a way of ordering binary numbers such that each consecutive number's values differ by exactly one bit. Some gray codes ... Read More

Program to recover shuffled queue of people in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 26-Nov-2020 06:57:07

204 Views

Suppose we have a 2D matrix where each row contains two values [height, count] these indicates the person has given height and there are 'count' number of people in front of them that are at least as tall as them. Now consider this queue is shuffled, we have to recover ... Read More

Program to find number of distinct quadruple that forms target sum in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 26-Nov-2020 06:52:43

421 Views

Suppose we have four lists of numbers A, B, C, and D, and also have a target value, we have to find the number of distinct quadruple (i, j, k, l) such that A[i] + B[j] + C[k] + D[l] is same as target.So, if the input is like A ... Read More

Program to find state of prison cells after k days in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 26-Nov-2020 06:50:07

410 Views

Suppose we have a binary list (1s and 0s in the list) and another value k. Each value in nums represents the state of a prison cell where 1 indicates occupied cell and 0 indicates empty cell. On each day when a cell has two adjacent cells that are either ... Read More

Program to find number of sublists we can partition so given list is sorted finally in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 26-Nov-2020 06:42:41

219 Views

Suppose we have a list of numbers called nums. We can partition the list into some individual sublists then sort each piece. We have to find the maximum number of sublists we can partition to such that nums as a whole is sorted afterwards.So, if the input is like nums ... Read More

Program to find number of ways we can split a palindrome in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 26-Nov-2020 06:40:20

398 Views

Suppose we have a string s, we have to find the number of ways we can partition the string such that each part is a palindrome.So, if the input is like s = "xyyx", then the output will be 3, as we have splits like: ["x", "yy", "x"], ["x", "y", ... Read More

Program to generate all possible strings by taking the choices in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 26-Nov-2020 06:36:28

493 Views

Suppose we have a string s of lowercase alphabet characters, other characters like "[", "|", and "]". Here "[a|b|c]" indicates either "a", "b", or "c" can be chosen as a possibility. We have to find a list of strings containing all possible values that s can represent. Here "[]" cannot ... Read More

Program to find minimum possible maximum value after k operations in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 26-Nov-2020 06:30:47

1K+ Views

Suppose we have a list of numbers called nums and another value k. Now let us consider an operation where we can subtract 1 from any element in the list. We can perform this operation k times. We have to find the minimum possible maximum value in the list after ... Read More

Advertisements