不会跑

Python、Linux 与算法实践笔记

这里记录 Python、Linux 和算法实践。教程从一个具体问题出发,解释选择一种实现的原因,并用小例子检查边界条件。

从这些教程开始

旧笔记保留在文章目录。文章上的日期是最初发布时间,修订日期会单独显示;运行旧代码前请留意 Python 和工具版本。

最近发布

22 Jun 2017

LeetCode-Edit_Distance

比较特殊的动态规划过程,原题链接:https://leetcode.com/problems/edit-distance/ Given two words word1 and word2, find the minimum number o...
22 Jun 2017

LeetCode-Delect_Operation_for_Two_Strings

LCS的变形题目, 只要求出两个字符串的最长公共子序列,那么最终需要进行删除操作的就是m+n-2*result。 Given two words word1 and word2, find the minimum number of ste...
22 Jun 2017

LeetCode-Best_Time_to_Buy_and_Sell_Stock

动态规划的小题目,买卖股票, 原题链接:https://leetcode.com/problems/best-time-to-buy-and-sell-stock/ Say you have an array for which the i...
22 Jun 2017

LeetCode-minimum_path_sum

经典的动态规划题,三种解法都是动态规划,但是最后一种空间复杂度最小,原题链接: https://leetcode.com/problems/minimum-path-sum/ Given a m x n grid filled with n...
21 Jun 2017

LeetCode-Longest_Consecutive_Sequence

题目的意思就是求出列表里最长的连续序列, 原题如下: Given an unsorted array of integers, find the length of the longest consecutive elements sequ...
21 Jun 2017

AUPE-11-线程同步及线程的Fork

线程是对进程的一种模仿,而协程(微线程)是对线程的一种模仿; 线程创建: # include "pthread_h" int pthread_create(pthread_t * restrict tidp, const p...
21 Jun 2017

fork 实验:独立的内存与共享的文件偏移

用单线程 Python 实验观察 fork 返回值、字典副本、共享文件偏移和 waitpid 回收,区分进程内存与内核中的打开文件状态。
20 Jun 2017

LeetCode-Remove_Duplicates_from_Sorted_Array

题目比较简单,就是需要你找出数组里面不同数字的个数,但是也要求把这些项搬运到nums数组的前面去 Given a sorted array, remove the duplicates in place such that each ele...
19 Jun 2017

LeetCode-power_of_three

Given an integer, write a function to determine if it is a power of three. Follow up: Could you do it without using any ...
10 Jun 2017

LeetCode-clone_graph

克隆一个图, 用了两个遍历方法如下: Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors. OJ’s ...