Imagine a simple input dialog box. The user is supposed to enter a positive integer from a given range into the box.
Recently you realized that sometimes you can tell that the user's input is invalid before he finishes entering the number.
For example, if the valid range is 300 to 347, and the user wants to enter the number 372, as soon as he types "37" you can be sure
that his input won't be valid.
More precisely, we call a number valid if it is a prefix of some number in the given range, and invalid otherwise.
You are given two ints smallest and largest (denoting the range of valid inputs),
and a int[] numbers.
The range of valid inputs contains all integers between smallest and largest, inclusive.
Write a method that will determine for each number in numbers whether it represents a valid input for the given range.
Return a String[] that has the same number of elements
as numbers. If the i-th element of numbers represents a valid input, the i-th element of the return value
has to be "VALID", otherwise it has to be "INVALID" (quotes for clarity only).
|