Tag: greedy algorithm
You are driving a vehicle that has capacity empty seats initially available for passengers. The vehicle only drives east (ie. it cannot turn around and drive west.) Given a …
Given an array A of integers, we must modify the array in the following way: we choose an i and replace A with -A, and we repeat this process …
Given a non-empty string s, you may delete at most one character. Judge whether you can make it a palindrome. Example 1: Input: “aba” Output: True Example 2: Input: …
Given an array A of positive lengths, return the largest perimeter of a triangle with non-zero area, formed from 3 of these lengths. If it is impossible to form …
Given an array A of integers, for each integer A we may choose any x with -K <= x <= K, and add x to A. After this process, …