Problem Statement | |||||||||||||
| You are given a String line containing a list of integers, each separated by one or more spaces. Given an int givenNumber, return the smallest int in line that is strictly greater than givenNumber. Return -1 if there is no such number in line. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Notes | |||||||||||||
| - | line may contain leading and/or trailing spaces. | ||||||||||||
Constraints | |||||||||||||
| - | line will contain between 1 and 50 characters, inclusive. | ||||||||||||
| - | Each character in line will be either a digit ('0'-'9') or a space (' '). | ||||||||||||
| - | line will contain a list of integers, separated by one or more spaces, where each integer is between 1 and 1000, inclusive, with no leading zeros. | ||||||||||||
| - | line will contain at least one integer. | ||||||||||||
| - | givenNumber will be between 1 and 1000, inclusive. | ||||||||||||
Examples | |||||||||||||
| 0) | |||||||||||||
| |||||||||||||
| 1) | |||||||||||||
| |||||||||||||
| 2) | |||||||||||||
| |||||||||||||
| 3) | |||||||||||||
| |||||||||||||
| 4) | |||||||||||||
| |||||||||||||