Merge pull request #1145 from shellhub/dev

update AnyBaseToDecimal and optimization
This commit is contained in:
Yang Libin
2019-10-28 14:08:08 +08:00
committed by GitHub
3 changed files with 30 additions and 38 deletions

View File

@ -134,7 +134,7 @@ public class SinglyLinkedList {
* @throws IndexOutOfBoundsException if {@code position} not in range {@code low} to {@code high}
*/
public void checkBounds(int position, int low, int high) {
if (position < low || position > high) {
if (position > high || position < low) {
throw new IndexOutOfBoundsException(position + "");
}
}

View File

@ -62,7 +62,7 @@ class BalancedBrackets {
case ')':
case ']':
case '}':
if (!(!bracketsStack.isEmpty() && isPaired(bracketsStack.pop(), bracket))) {
if (bracketsStack.isEmpty() || !isPaired(bracketsStack.pop(), bracket)) {
return false;
}
break;