Tag: O(n)
Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time complexity must be in …
Given an array of numbers (for simplicity, we use integers), find the maximum value of abs(max left – max right) where we separate the array into two. Mathematically, given …
There are N gas stations along a circular route, where the amount of gas at station i is gas. You have a car with an unlimited gas tank and …
The problem is from SPOJ Online Judge The puzzle asks to you check if the given sequence of integers consists of strictly two parts: the first part descending and …
The problem is from Timus Online Judge. Den only has two locks. He never uses the same lock two days in a row. Therefore, if the thief wants to …