- 博客(4)
- 收藏
- 关注
原创 Day4:Leetcode-92. Reverse Linked List
Sloution 1:# Definition for singly-linked list.# class ListNode:# def __init__(self, val=0, next=None):# self.val = val# self.next = nextclass Solution: def reverseBetween(self, head: ListNode, left: int, right: int) -.
2021-09-22 20:18:39
145
1
原创 Day3:Leetcode-206. Reverse Linked List
In a linknode list,we define a = list(),then we add some nodes,if we write a[0].next = a[1], that's fine ,it works, but when we turn to a[1].next = a[0],it time exceed,which confused me a lot.But finally I solved it. because,if we say a[1].next = a[0]...
2021-09-20 20:21:00
160
原创 Day2:Leetcode-83.Remove Duplicates from Sorted List
Solution 1:It is a sorted linked list, we can delete all duplicates one by one,but at first I made a mistake in case [0,0,0,0,0] , because I set pre number 0,therefore I turn it to be -99,that is okay.class Solution {public: ListNode* deleteDu.
2021-09-19 19:57:17
175
原创 Day1:Leetcode-19.Remove Nth Node From End of List
Tips:There is something noteworthy in C++ code,function getlen(LinkList * head),this formal parameteris fake,if we call thisfuntion,ouractual parameter head will not change。That is different from array,for instance int fun(int a[]),it will change our a...
2021-09-18 21:49:11
226
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人