We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents b33c778 + 2b83b31 commit 0d1110aCopy full SHA for 0d1110a
DataStructures/Lists/SinglyLinkedList.java
@@ -68,7 +68,7 @@ public void deleteHead() {
68
* This method deletes an element at Nth position
69
*/
70
public void deleteNth(int position) {
71
- if (position < 0 || position > getSize()) {
+ if (position < 0 || position >= getSize()) {
72
throw new RuntimeException("position less than zero or position more than the count of list");
73
} else if (position == 0)
74
deleteHead();
0 commit comments