摘要:
class insertionsort(): def insertion_sort(self,Array): for i in range(1, len(Array)): key = Array[i] j = i - 1 ... 阅读全文
摘要:
最简单的不相交集的实现,来自MAW的《数据结构与算法分析》。代码:class DisjSet: def __init__(self, NumSets): self.S = [0 for i in range(NumSets+1)] def SetUnion(self, S,... 阅读全文
摘要:
二叉树的插入与删除,来自Mark Allen Weiss的《数据结构与算法分析》。# Definition for a binary tree nodeclass TreeNode: def __init__(self, x): self.val = x self... 阅读全文
摘要:
原题地址:https://oj.leetcode.com/problems/add-two-numbers/题意:You are given two linked lists representing two non-negative numbers. The digits are stored i... 阅读全文
摘要:
原题地址:https://oj.leetcode.com/problems/longest-substring-without-repeating-characters/题意:Given a string, find the length of the longest substring witho... 阅读全文
摘要:
原题地址:https://oj.leetcode.com/problems/reverse-nodes-in-k-group/题意:Given a linked list, reverse the nodes of a linked listkat a time and return its mod... 阅读全文
摘要:
原题地址:https://oj.leetcode.com/submissions/detail/5341904/题意:The set[1,2,3,…,n]contains a total ofn! unique permutations.By listing and labeling all of ... 阅读全文
摘要:
原题地址:https://oj.leetcode.com/problems/merge-two-sorted-lists/题意:Merge two sorted linked lists and return it as a new list. The new list should be made... 阅读全文
摘要:
原题地址:https://oj.leetcode.com/problems/rotate-list/题意:Given a list, rotate the list to the right bykplaces, wherekis non-negative.For example:Given1->2... 阅读全文
摘要:
原题地址:https://oj.leetcode.com/problems/minimum-window-substring/题意:Given a string S and a string T, find the minimum window in S which will contain all... 阅读全文
摘要:
原题地址:https://oj.leetcode.com/problems/unique-paths-ii/题意:Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many ... 阅读全文
摘要:
原题地址:https://oj.leetcode.com/problems/unique-paths/题意:A robot is located at the top-left corner of amxngrid (marked 'Start' in the diagram below).The ... 阅读全文
摘要:
原题地址:https://oj.leetcode.com/problems/maximal-rectangle/题意:Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all... 阅读全文
摘要:
原题地址:https://oj.leetcode.com/problems/largest-rectangle-in-histogram/题意:Givennnon-negative integers representing the histogram's bar height where the ... 阅读全文
摘要:
原题地址:https://oj.leetcode.com/problems/decode-ways/题意:A message containing letters fromA-Zis being encoded to numbers using the following mapping:'A' -... 阅读全文