Problem Statement
All problems in this problem set are about "chains": collections of nested ranges of integers. All problems are independent, but use the same definitions. Each problem statement contains the definitions it needs. If a term appears in multiple problems, the definition is always identical.
Definitions follow. The defined term is always in uppercase.
- An INTERVAL [x,y) with x <= y is the set of integers that are greater than or equal to x, and strictly less than y.
- There is only one EMPTY INTERVAL but it has multiple equivalent notations. For example, [0,0) and [3,3) both denote the empty interval. Note that [3,0) is not a valid interval, because an interval [x,y) must have x <= y.
- An interval I1 is called a PROPER SUBSET of an interval I2 if I2 contains all elements of I1 and at least one other element.
You are given the ints x and y. These represent a interval [x,y) that contains at least two numbers. Find any nonempty interval [a,b) that is a proper subset of [x,y).
Return the int[] {a, b}. That is, return a int[] with two elements, the first of which is your a and the second is your b. Any valid solution will be accepted.
Definition
- Class:
- Chains0
- Method:
- getProperSubset
- Parameters:
- int, int
- Returns:
- int[]
- Method signature:
- int[] getProperSubset(int x, int y)
- (be sure your method is public)
Constraints
- x will be between 0 and 50, inclusive.
- y will be between x+2 and 50, inclusive.
Examples
10
47
Returns: {23, 29 }12
15
Returns: {13, 14 }0
50
Returns: {23, 29 }