Given an array A of integers, find the sum of min(B), where B ranges over every (contiguous) subarray of A. Since the answer may be large, r...
Read More
Reach a Number
You are standing at 0 on an infinite number line, you have to reach the target. On each move, you can either move to the right or to left. D...
Read More
Interview Preparation Books
Cracking the Coding Interview (Indian Edition) by Caree...
Read More
Remove comments
From a C++ program remove all the comments. The program source is an array where source[i] is the i-th line of source code. The array repres...
Read More
Can make palindrome from substring
We are given a string s, we make queries on it. For each query queries[i] = [left,right,x], the substring from s[left] to s[right] can be r...
Read More
Cinema seat allocation
A cinema has n rows, numbered from 1 to n. There are 10 seats in each row, labelled from 1 to n as shown above. We are given an array occupi...
Read More
Swapping adjacents in LR string
We are given a string that is composed of characters "X", "L", "R", like "XXLRXLRXXX", where L repr...
Read More
Subscribe to:
Posts (Atom)
Sum of Subarray Minimums
Given an array A of integers, find the sum of min(B), where B ranges over every (contiguous) subarray of A. Since the answer may be large, r...
