Arnab Chakraborty has Published 4293 Articles

Find the character in first string that is present at minimum index in second string in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Aug-2020 11:31:23

351 Views

Suppose we have a string str and another string patt, we have to find determine the character in patt that is present at the minimum index of str. If no character patt1 is present in str1 then return -1.So, if the input is like str = "helloworld" and patt = ... Read More

Find sum of all elements in a matrix except the elements in row and-or column of given cell in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Aug-2020 11:30:03

915 Views

Suppose we have a 2D matrix and a set of cell indexes. Cell indices are represented as (i, j) where i is row and j is column, now, for every given cell index (i, j), we have to find the sums of all matrix elements excluding the elements present in ... Read More

Find substrings that contain all vowels in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Aug-2020 11:28:19

875 Views

Suppose we have a string in lowercase alphabets, we have to find substrings that contain all the vowels at least once and there exist no consonants in that substrings.So, if the input is like "helloworldaeiouaieuonicestring", then the output will be ['aeiou', 'aeioua', 'aeiouai', 'aeiouaiu', 'eioua', 'eiouai', 'eiouaiu']To solve this, we ... Read More

Find subsequences with maximum Bitwise AND and Bitwise OR in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Aug-2020 11:26:24

749 Views

Suppose we have an array of n elements, we have to show the maximum sum by choosing two subsequences of the array (they may or may not be different) so that the sum of bit-wise AND operation of all elements of the first subsequence and bit-wise OR operation of all ... Read More

Find sub-arrays from given two arrays such that they have equal sum in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Aug-2020 11:24:34

371 Views

Suppose we have two arrays P and Q whose size are N, they are holding numbers 1 to N. We have to find sub-arrays from the given arrays so that they have equal sum. Finally return the indices of such sub-arrays. If there is no solution, then return -1.So, if ... Read More

Find smallest range containing elements from k lists in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Aug-2020 11:22:18

88 Views

Suppose we have k different lists. The elements are sorted. We have to search the smallest range that includes at least one number from each of the k different lists. Here the range [a, b] is smaller than range [c, d] when b-a < d-c or a < c if ... Read More

Find Shortest distance from a guard in a Bankin Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Aug-2020 11:19:35

189 Views

Suppose we have a matrix that is filled with three letters 'O', 'G', and 'W' where 'O' is representing open space, 'G' is representing guards and 'W' is representing walls in a bank, we have to replace all of the O's in the matrix with respect of their shortest distance ... Read More

Find same contacts in a list of contacts in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Aug-2020 11:16:45

264 Views

Suppose we have a list of contacts holding username, email and phone number in any order, we have to find the same contacts (When same person have many different contacts) and return the same contacts together. We have to keep in mind that −A contact can store username, email and ... Read More

Find multiplication of sums of data of leaves at same levels in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Aug-2020 11:12:34

132 Views

Suppose we have a Binary Tree. We have to perform following operations −For each level, find sum of all leaves if there are leaves at this level. Otherwise ignore it.Find multiplication of all sums and return it.So, if the input is likethen the output will be 270. First two levels ... Read More

Find paths from corner cell to middle cell in maze in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Aug-2020 11:09:16

362 Views

Suppose we have a square maze filled with numbers; we have to find all paths from a corner cell to the middle cell. Here, we will proceed exactly n steps from a cell in 4 directions Up, Down, Right and Left where n is the value of the cell. Thus, ... Read More

Advertisements