Arnab Chakraborty has Published 4293 Articles

Program to find out the sum of the maximum subarray after a operation in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 07-Oct-2021 11:44:21

185 Views

Suppose, we are given an array containing integer numbers. We can perform an operation where we can replace the value of array[i] with its squared value; or array[i] * array[i]. Only one operation of this kind is permitted and we have to return the sum of the maximum possible subarray ... Read More

Program to restore the array from adjacent pairs in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 07-Oct-2021 11:39:28

254 Views

Suppose we have a 2D array called adPair of size n-1 where each adPair[i] has two elements [ui, vi] represents that the elements ui and vi are adjacent in an array called nums, in nums there are n unique elements. We have to find the array nums. If there are ... Read More

Program to find out distance between two nodes in a binary tree in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 07-Oct-2021 11:33:05

777 Views

Suppose, we are given a binary tree and are asked to find the distance between two nodes in the binary tree. We find out the edges between the two nodes like in a graph and return the number of edges or the distance between them. A node of a tree ... Read More

Program to find k-th largest XOR coordinate value in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 07-Oct-2021 11:19:54

177 Views

Suppose we have one m x n matrix. and another value k. Here the value of coordinate (a, b) of the matrix is the XOR of all matrix[i, j] where i in range (0 to a) and j in range (0 to b). We have to find the kth largest ... Read More

Program to change minimum characters to satisfy one of three conditions in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 07-Oct-2021 11:10:15

182 Views

Suppose we have two strings s and t with only lowercase letters. In one operation, we can change any character in s or t to any lowercase letter. We have to satisfy one of the following three conditions −Every letter in s is strictly smaller than every letter in t ... Read More

Program to find decode XORed permutation in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 07-Oct-2021 11:04:03

225 Views

Suppose we have an array enc. There is an array perm that is a permutation of the first n(odd) positive integers. This list will be encoded into array enc of length n-1, such that enc[i] = perm[i] XOR perm[i+1]. We have to find the original array perm.So, if the input ... Read More

Program to find minimum number of people to teach in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 07-Oct-2021 11:01:44

194 Views

Suppose we have a number n, an array called 'languages', and an array called 'friendships', so there are n languages numbered from 1 through n, languages[i] represents a set of languages the ith user knows, and friendships[i] holds a pair [ui, vi] denotes a friendship between the users ui and ... Read More

Program to find minimum cost to hire k workers in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 07-Oct-2021 09:27:16

342 Views

Suppose we have an array called quality for each different worker, and have another array called wages and a value K. The i-th worker has a quality[i] and a minimum wage expectation wage[i]. We want to hire K workers to form a paid group. When we are hiring a group ... Read More

Program to check a string can be split into three palindromes or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 07-Oct-2021 09:22:02

586 Views

Suppose we have a string s. We have to check whether we can split s into three palindromic substring or not.So, if the input is like s = "levelpopracecar", then the output will be True because we can split it like "level", "pop", "racecar", all are palindromes.To solve this, we ... Read More

Program to find minimum cost to merge stones in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 07-Oct-2021 09:18:18

281 Views

Suppose we have N piles of stones arranged in a row. Here the i-th pile has stones[i] number of stones. A move consists of merging K consecutive piles into one pile, now the cost of this move is equal to the total number of stones in these K number of ... Read More

Advertisements