Tag: greedy algorithm
Given two strings s1 and s2, determine if s1 is a subsequence of s2. A string a is a subsequence of another string b if you can delete some …
You are given two arrays rowSum and colSum of non-negative integers where rowSum is the sum of the elements in the ith row and colSum is the sum of …
Slow Sums Algorithms Suppose we have a list of N numbers, and repeat the following operation until we’re left with only a single number: Choose any two numbers and …
Given a sequence of n integers arr, determine the lexicographically smallest sequence which may be obtained from it after performing at most k element swaps, each involving a pair …
Given a string s of ‘(‘ , ‘)’ and lowercase English characters. Your task is to remove the minimum number of parentheses ( ‘(‘ or ‘)’, in any positions …