Arnab Chakraborty has Published 4452 Articles

Program to find the indexes where the substrings of a string match with another string fully or differ at one position in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 08:59:46

139 Views

Suppose, we are provided with two strings. The first one has a length greater than the second one, and we have to check if the substrings from the first string match exactly with the second string or differ in one position. We return the indexes of the first string, where ... Read More

Program to find maximum possible value of an expression using given set of numbers in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 08:50:15

252 Views

Suppose we have two arrays called nums1 and nums2, they have same number of elements N. Now consider a set S with N elements from 1 through N. We have to find the value of (nums1[i1] + nums1[i2] + ... nums1[ik])^2 + (nums2[i1] + nums2[i2] + ... nums2[ik])^2 where {i1, ... Read More

Program to find out the similarity between a string and its suffixes in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 08:47:00

86 Views

Suppose, we are given a string 'input_str'. If we determine all the suffixes from input_str; for example if the string is 'abcd', the suffixes are 'abc', 'bcd', 'cd', 'd'. Now, we check the similarity between input_str and all the suffixes by the length of the longest common prefix in input_str ... Read More

Program to find out the letter at a particular index in a synthesized string in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 08:41:28

82 Views

Suppose, we are given a string 'input_str'. Now, we are asked to determine every possible substring from the given string then concatenate all the substrings one after another in a lexical order into another string. We are also provided an integer value k. Our task is to return the letter ... Read More

Program to find out the sum of numbers where the correct permutation can occur in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 08:37:08

109 Views

Suppose, we are given a number n and are asked to write all the possible permutations with the positive integers up to n. The permutations are then sorted lexicographically and numbered from 1 to n. Among all the permutations, one permutation is taken and is termed as the special permutation. ... Read More

Program to determine the minimum cost to build a given string in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 08:24:58

876 Views

Suppose, we have to build a string 'str' that is of length n. To build the string, we can perform two operations.A character can be added to the end of str for cost a.A substring sub_str can be added to the end of the str for cost r.We have to ... Read More

Program to find maximum score by splitting binary strings into two parts in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 08:17:59

269 Views

Suppose we have a binary string s. Now let us consider an operation, where we split the string into two non-empty substrings s1 and s2. The score of this split is the sum of "0"s count in s1 and sum of "1"s count in s2. We have to find the ... Read More

Program to find matrix for which rows and columns holding sum of behind rows and columns in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 08:16:23

78 Views

Suppose we have a given matrix, We have to find a new matrix res, whose dimension is same as the given matrix where each element in res[i, j] = sum of the elements of matrix[r, c] for each r ≤ i, and c ≤ j.So, if the input is like8274then ... Read More

Program to find length of longest sublist containing repeated numbers by k operations in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 08:12:58

171 Views

Suppose we have a list called nums and a value k, now let us consider an operation by which we can update the value of any number in the list. We have to find the length of the longest sublist which contains repeated numbers after performing at most k operations.So, ... Read More

Program to find length of longest contiguous sublist with same first letter words in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 08:10:34

147 Views

Suppose we have a list of lowercase alphabet strings called words. We have to find the length of the longest contiguous sublist where the first letter of each words have the same first letter.So, if the input is like words = ["she", "sells", "seashells", "on", "the", "sea", "shore"], then the ... Read More

Advertisements