Arnab Chakraborty has Published 4452 Articles

Program to find sum of non-adjacent elements in a circular list in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Nov-2020 06:49:49

216 Views

Suppose we have a list of numbers called nums that is representing a circular list. We have to find the largest sum of non-adjacent numbers.So, if the input is like nums = [10, 3, 4, 8], then the output will be 14, as we can take 10 and 4. We ... Read More

Program to find the sum of largest K sublist in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Nov-2020 06:48:55

202 Views

Suppose we have a list of numbers called nums, and another value k, which represents a large list of nums concatenated k times. We have to find the sum of the contiguous sublist with the largest sum.So, if the input is like nums = [1, 3, 4, -5], k = ... Read More

Program to find area of largest island in a matrix in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Nov-2020 06:44:56

318 Views

Suppose we have a binary matrix. Here 1 represents land and 0 represents water, And an island is a group of 1s that are neighboring whose perimeter is surrounded by water. We can assume that the edges of the matrix are surrounded by water. We have to find the area ... Read More

Program to find largest distance pair from two list of numbers in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Nov-2020 06:43:02

120 Views

Suppose we have two list of numbers called A and B, and their lengths are same. We have to find the maximum value for all 0 ≤ i < j < n: |a[i] - a[j]| + |b[i] - b[j]| + |i - j|So, if the input is like A = ... Read More

Program to find difference between node and a descendent in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Nov-2020 06:41:49

90 Views

Suppose we have a binary tree, we have to find the largest absolute difference between any node and its descendants.So, if the input is likethen the output will be 7 as largest absolute difference is between nodes 8 and 1.To solve this, we will follow these steps −Define a function ... Read More

Program to find the percentage of places where knight can move and not left the board in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Nov-2020 06:39:14

110 Views

Suppose we have four values n, x, y, and k. Here n indicates an n x n chessboard and x, y coordinate represents a knight is placed at (x, y). The knight has to take exactly k steps, where at each step it can move any of the 8 directions ... Read More

Program to find minimum steps to reach target position by a chess knight in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Nov-2020 06:37:29

790 Views

Suppose we have two values r and c. If a chess knight is placed at the coordinate (0, 0) at the beginning in an infinitely large chess board, we have to find minimum number of moves it would take to reach the location (r, c). The knight will follow same ... Read More

Program to find k sublists with largest sums and return sums in ascending order in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Nov-2020 06:36:22

114 Views

Suppose we have a list of numbers called nums, and another value k, we have to find k sublists with the largest sums and return the sums in non-decreasing order.So, if the input is like nums = [2, 4, 5, -100, 12, -30, 6, -2, 6] k = 3, then ... Read More

Program to find a sub-list of size at least 2 whose sum is multiple of k in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Nov-2020 06:34:05

96 Views

Suppose we have a list of non-negative numbers called nums and another positive value k. We have to find check whether there is any sublist of length at least 2 whose sum is multiple of k or not.So, if the input is like nums = [12, 6, 3, 4] k ... Read More

Program to find number of elements in A are strictly less than at least k elements in B in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Nov-2020 06:32:36

1K+ Views

Suppose we have two lists of numbers A and B, and another value k, we have to find the number of elements in A that are strictly less than at least k elements in B.So, if the input is like A = [6, -2, 100, 11] B = [33, 6, ... Read More

Advertisements