Skip to content

Commit fccda5e

Browse files
fix tests
1 parent 81dacbe commit fccda5e

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/main/java/com/fishercoder/solutions/_86.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public ListNode partition(ListNode head, int x) {
4545
}
4646
ListNode pre = new ListNode(-1);
4747
ListNode tmp = pre;
48-
int i = 1;
48+
int i = 0;
4949
int j = 0;
5050
while (i < first.size() || j < last.size()) {
5151
if (i < first.size()) {

src/test/java/com/fishercoder/_86Test.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ public void test1() {
2727
head = LinkedListUtils.createSinglyLinkedList(Arrays.asList(1, 4, 3, 2, 5, 2));
2828
expected = LinkedListUtils.createSinglyLinkedList(Arrays.asList(1, 2, 2, 4, 3, 5));
2929
assertEquals(expected, (solution1.partition(head, 3)));
30+
}
31+
32+
@Test
33+
public void test2() {
34+
head = LinkedListUtils.createSinglyLinkedList(Arrays.asList(1, 4, 3, 2, 5, 2));
35+
expected = LinkedListUtils.createSinglyLinkedList(Arrays.asList(1, 2, 2, 4, 3, 5));
3036
assertEquals(expected, (solution2.partition(head, 3)));
3137
}
3238

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy