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

+1-1
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

+6
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)