mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-14 17:32:35 +08:00
Merge pull request #1145 from shellhub/dev
update AnyBaseToDecimal and optimization
This commit is contained in:
@ -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 + "");
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user