Problem Statement | |||||||||||||
You're given a set of inequalities. Each of the inequalities refers to the variable X. Determine the maximum subset of the given set which has a solution. To make your task easier, the inequalities in the given set are always reduced to one of the following five forms: X < C X <= C X = C X > C X >= CHere, C indicates some non-negative integer constant. The inequalities are given in the String[] inequalities, where each element is a single inequality formatted as shown above. Return the maximal number of inequalities of the set which can be satisfied simultaneously. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Notes | |||||||||||||
- | Note that X doesn't have to be an integer or positive number. | ||||||||||||
Constraints | |||||||||||||
- | inequalities will contain between 1 and 50 elements, inclusive. | ||||||||||||
- | Each element of inequalities will be formatted "X <E> <C>", where 'X' is uppercase, <E> is one of "<", "<=", "=", ">=" or ">", and <C> is an integer between 0 and 1000, inclusive, with no extra leading zeroes (all quotes for clarity). | ||||||||||||
- | No two elements of inequalities will be equal. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
|