Arnab Chakraborty has Published 4293 Articles

Program to decode a given message in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Oct-2021 10:59:55

1K+ Views

Suppose we are given an encoded message that is a string of integer numbers. Now, these integer numbers can be mapped to a specific letter in the alphabet. a is mapped to 1, b is mapped to 2, c is mapped to 3, and so on. There is also a ... Read More

Program to find out the cost to merge an array of integers into a single value in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Oct-2021 10:59:29

134 Views

Suppose we are given an array arr that contains n positive integer numbers. We are also given an integer number j. The task we have to perform is to merge j numbers into a single number by adding them. The cost of merging is equal to the addition of the ... Read More

Program to find length of longest repeating substring in a string in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Oct-2021 10:46:49

3K+ Views

Suppose we have a lowercase string s, we have to find the length of the longest substring that occurs at least twice in s. If we cannot find such string, return 0.So, if the input is like s = "abdgoalputabdtypeabd", then the output will be 3, because the longest substring ... Read More

Program to find length longest prefix sequence of a word array in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Oct-2021 10:43:22

235 Views

Suppose we have a list of words called w, with lowercase strings. We have to find the length of the longest sequence of w where each previous word is the prefix of the next word and the next word has just one new character appended.So, if the input is like ... Read More

Program to find length of longest matrix path length in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Oct-2021 10:40:59

286 Views

Suppose we have a binary matrix, where 0 indicates empty cell and 1 indicates wall. We can start at any empty cell on first row and want to end up on any empty cell on the last row. We can move left, right, or down, we have to find the ... Read More

Program to find length of longest contiguously strictly increasing sublist after removal in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Oct-2021 10:37:33

528 Views

Suppose we have a list of numbers called nums, we have to find the maximum length of a contiguous strictly increasing sublist. We are allowed to remove at most single element from the list.So, if the input is like nums = [35, 5, 6, 7, 8, 9, 12, 11, 26], ... Read More

Program to find length of longest consecutively increasing substring in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Oct-2021 10:34:44

228 Views

Suppose we have a lowercase string s. This contains English letters as well as "?" Symbol. For each "?" we must either remove it or replace it with any lowercase letter. We have to find the length of the longest consecutively increasing substring that starts with letter "a".So, if the ... Read More

Program to find longest consecutive run of 1s in binary form of n in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Oct-2021 10:29:27

730 Views

Suppose we have a non-negative value n, we have to find the length of the longest consecutive run of 1s in its binary representation.So, if the input is like n = 1469, then the output will be 4, because binary representation of 156 is "10110111101", so there are four consecutive ... Read More

Program to find length of longest arithmetic subsequence with constant difference in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Oct-2021 10:26:39

216 Views

Suppose we have a list of numbers nums and another value diff, we have to find the length of the longest arithmetic subsequence where the difference between any consecutive numbers in the subsequence is same as diff.So, if the input is like nums = [-1, 1, 4, 7, 2, 10] ... Read More

Program to find length of longest substring with 1s in a binary string after one 0-flip in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Oct-2021 10:24:25

657 Views

Suppose we have a binary string s. We are allowed to flip at most one "0" to "1", we have to find the length of the longest contiguous substring of 1s.So, if the input is like s = "1010110001", then the output will be 4, as if we flip the ... Read More

Advertisements