- 博客(13)
- 收藏
- 关注
原创 SOSP论文dSpace: Composable Abstractions for Smart Spaces 总结
Paper review for dSpace paper from SOSP 2021
2023-02-13 12:58:25 155
原创 python 小贴士
import datetimetoday = datetime.date.today()# Result of __str__ should be readable:str(today)# output: '2017-02-02'# Result of __repr__ should be unambiguous:repr(today)# output: 'dateti...
2019-12-04 03:48:56 124
原创 [Lintcode 108] Palindrome Partitioning II
DescriptionGiven a string s, cut s into some substrings such that every substring is a palindrome.Return the minimum cuts needed for a palindrome partitioning of s.ExamplesExample 1:Input: “a”Ou...
2019-12-02 04:21:18 146
原创 [Lintcode 136] Palindrome Partitioning
DescriptionEnglishGiven a string s. Partition s such that every substring in the partition is a palindrome.Return all possible palindrome partitioning of s.ExamplesExample 1:Input: “a”Output: [...
2019-12-02 02:19:04 95
原创 [Lintcode 11] Search Range in Binary Search Tree
DescriptionGiven a binary search tree and a range [k1, k2], return node values within a given range in ascending order. (https://www.lintcode.com/problem/search-range-in-binary-search-tree/descriptio...
2019-11-27 10:03:15 150
原创 python itertools
# itertools.permutations() 可以用来获取可迭代型数据的全排列# 一个使用的例子是暴力破解密码import itertoolsfor p in itertools.permutations('ABCD'): print(p)('A', 'B', 'C', 'D')('A', 'B', 'D', 'C')('A', 'C', 'B', 'D')('A', ...
2019-11-25 01:06:25 163
原创 heap
def heapify(arr, n, i):largest = i # Initialize largest as rootl = 2 * i + 1 # left = 2i + 1r = 2 * i + 2 # right = 2i + 2# See if left child of root exists and is # greater than root if...
2019-08-30 02:41:18 85
原创 Sorting
iterates through array swapping elements to find the smallest.def bubbleSort(arr):n = len(arr)for i in range(n):for j in range(0, n-i-1):if arr[j] > arr[j+1] :arr[j], arr[j+1] = arr[j+1], arr...
2019-08-29 15:18:28 103
原创 BFS and DFS
Breath First Search (BFS)def bfs(self, s): visited = [False] * (len(self.graph)) queue = [] queue.append(s) visited[s] = True while queue: # Dequeue a vertex from # queu...
2019-08-29 15:17:05 180
原创 Fine-grained Metadata Journaling on NVM 总结
Fine-grained Metadata Journaling on NVMPaper link:http://storageconference.us/2016/Papers/Fine-GrainedJournaling.pdfBelow are some key points that are worth mentioning:Updating data larger than ...
2019-08-27 02:13:22 201
原创 880. Decoded String at Index
比如,对于一个解码了的字符串 hello5,并且要求的索引K=18的话,那么结果和K=3是一样的。因为单词hello的size=5,并且被重复了5次。所以第K个字符和第mod(K, size)个字符是相同的。代码如下:class Solution(object): def decodeAtIndex(self, S, K): """ :type...
2019-07-03 10:28:46 150
原创 Leetcode -- Backtracking
Gray codeclass Solution(object): def grayCode(self, n): """ :type n: int :rtype: List[int] """ def helper(i, arr): if i == -1: ...
2019-05-06 03:04:48 70
原创 Leetcode 动态规划解析 (1)
Leetcode – House Robber 解析题目链接:https://leetcode.com/problems/house-robber/答案class Solution(object): def rob(self, nums): """ :type nums: List[int] :rtype: int "...
2019-05-05 03:26:40 127
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人