Problem Statement | |||||||||||||
This problem contains HTML superscripts which may not display properly for plugin users. Please use the applet to view the problem statement and examples
You are given a list of integer intervals, ranges, where each interval is specified by a String of the form "<low>-<high>" (quotes for clarity). Here "<low>" and "<high>" represent non-negative integers (sequences of characters between '0' and '9' inclusive with no leading zeros) which are separated by a single hyphen '-'. Your task is to find the largest integer that is in at least one of the intervals and is a perfect cube. Return this integer in a String with no extra leading zeros and only the digits '0'-'9'. In other words, find the largest integer in the intervals that is equal to n3 for some integer n. If there is no perfect cube in the intervals, return the empty string, "" (quotes for clarity). For example {"1-1000000000001"} would return "1000000000000" which is 100003. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Notes | |||||||||||||
- | C++ users: the 64 bit integer type is long long. | ||||||||||||
Constraints | |||||||||||||
- | range will have between 1 and 50 elements inclusive. | ||||||||||||
- | Each element of range will contain between 3 and 31 characters inclusive. | ||||||||||||
- | Each element of range will be of the form "<low>-<high>" where <low> and <high> are separated by exactly one hyphen, '-'. | ||||||||||||
- | Each character of <low> and <high> will be a digit between '0' and '9' inclusive. | ||||||||||||
- | <low> and <high> will contain no leading zeros. | ||||||||||||
- | <low> and <high> will be between 0 and 1000000000000000000 (1e15) inclusive. | ||||||||||||
- | <low> will be less than or equal to <high> | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
| |||||||||||||
4) | |||||||||||||
|