- Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy path_1474.java
25 lines (23 loc) · 774 Bytes
/
_1474.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
packagecom.fishercoder.solutions.secondthousand;
importcom.fishercoder.common.classes.ListNode;
publicclass_1474 {
publicstaticclassSolution1 {
publicListNodedeleteNodes(ListNodehead, intm, intn) {
ListNodepre = newListNode(-1);
ListNodetmp = pre;
while (head != null) {
intmCount = m;
while (head != null && mCount-- > 0) {
tmp.next = newListNode(head.val);
head = head.next;
tmp = tmp.next;
}
intnCount = n;
while (head != null && nCount-- > 0) {
head = head.next;
}
}
returnpre.next;
}
}
}