Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenzhang1007 committed Aug 12, 2020
1 parent 2f06ab6 commit 0a0df70
Show file tree
Hide file tree
Showing 13 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion array/283_移动零/283_easy_移动零.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def moveZeroes(self, nums):
"""
if not nums:
return 0

""" O(N^2)
for i in range(len(nums)):
if nums[i] == 0 :
Expand All @@ -58,7 +59,7 @@ def moveZeroes(self, nums):
j += 1
"""

""" O(N)
"""O(N)
# 第一次遍历,j指针记录非零个数,只要是非0的统统赋值给nums[j]
j = 0
for i in range(len(nums)) :
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes
4 changes: 2 additions & 2 deletions linked-list/206_反转链表/206_easy_反转链表.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@

class Solution:
def reverseList(self, head: ListNode) -> ListNode:
leftNode = None;
midNode = head;
leftNode = None
midNode = head
while midNode :
rightNode = midNode.next
midNode.next = leftNode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
# self.val = x
# self.next = None


class Solution:
def reverseKGroup(self, head: ListNode, k: int) -> ListNode:
dummy = ListNode(-1)
Expand Down Expand Up @@ -76,7 +77,6 @@ def reverseKGroup(self, head: ListNode, k: int) -> ListNode:
return dummy.next




Solution().reverseKGroup([1,2,3,4,5], 2)
# @lc code=end

0 comments on commit 0a0df70

Please sign in to comment.