
leetcode
just-run
尽量每天都要进步噢!
展开
-
138. 复制带随机指针的链表(迭代法、回溯法)-python
138. 复制带随机指针的链表"""# Definition for a Node.class Node: def __init__(self, x: int, next: 'Node' = None, random: 'Node' = None): self.val = int(x) self.next = next self.random = random"""class Solution: # cached_node = {原创 2022-04-04 23:46:02 · 850 阅读 · 0 评论 -
【leetcode链表篇】216.反转链表--双指针、递归
class Solution: def reverseList(self, head: ListNode) -> ListNode: pre = None cur = head while cur: tmp = cur.next cur.next = pre pre = cur cur = tm.原创 2022-03-29 23:18:39 · 147 阅读 · 0 评论 -
顺时针打印矩阵(带注释)
class Solution { public int[] spiralOrder(int[][] matrix) { if(matrix==null||matrix.length==0||matrix[0].length==0){ return new int[0]; } int rows = matrix.length; int colums = matrix[0].length; Bool.原创 2021-01-06 16:11:44 · 100 阅读 · 0 评论