Skip to content

Instantly share code, notes, and snippets.

View lttzzlll's full-sized avatar

liutaotao lttzzlll

  • http://metasota.ai/
View GitHub Profile
@lttzzlll
lttzzlll / md5_file.py
Created April 27, 2018 06:04
python md5 two files
import hashlib
def md5(fname):
hash_md5 = hashlib.md5()
with open(fname, "rb") as f:
for chunk in iter(lambda: f.read(4096), b""):
hash_md5.update(chunk)
return hash_md5.hexdigest()
from operator import xor
from functools import reduce
a = [2,3,3,2,1]
r = reduce(xor, a, 0)
# r = 1
@lttzzlll
lttzzlll / leetcode.md
Last active July 3, 2018 12:49
leetcode

课程大纲:

第一课:链表

  1. 链表的基础知识
  2. 例1-链表逆序 (LeetCode 206)
  3. 例2-链表中间段逆序(LeetCode 92)
  4. 例3-求两个链表的交点(LeetCode 160)
  5. 例4-两个排序链表的合并(LeetCode 21)
  6. 例5-链表求环(LeetCode 142)
  7. 例6-链表划分(LeetCode 86)
ps -ef|grep python|grep -v grep|cut -c 7-12 | xargs kill -9
BAIDUNEWS_UTC_FORMAT_PATTERN1 = r'^(?P<publisher>\S+)\s+(((?P<year>\d{4})年(?P<month>\d{2})月(?P<day>\d{2})日\s+(?P<hour>\d{2}):(?P<minute>\d{2}))|(?P<beforetime>(?P<pubint>\d+)(?P<pubtype>分钟|小时)前))$'

mysql

  1. 主键 超键 候选键 外键

主 键:

数据库表中对储存数据对象予以唯一和完整标识的数据列或属性的组合。一个数据列只能有一个主键,且主键的取值不能缺失,即不能为空值(Null)。

超 键:

def max_count(string):
"""count max length of no-26 length
>>> max_count('')
0
>>> max_count('1')
1
>>> max_count('12')
def delete_reoccurring_chars(string):
"""Return the string after deduplication.
>>> delete_reoccurring_chars('metasotaaaa')
'metasota'
>>> delete_reoccurring_chars('mmeettaassoottaa')
'metasota'
>>> delete_reoccurring_chars('metasota')
'metasota'
import unittest
def dp(nums, m, n, i, j, visit):
ll, uu, rr, dd = [], [], [], []
if i - 1 >= 0 and not visit[i - 1][j] and nums[i - 1][j] < nums[i][j]:
visit[i][j] = True
uu = dp(nums, m, n, i - 1, j, visit)
if j - 1 >= 0 and not visit[i][j - 1] and nums[i][j - 1] < nums[i][j]:
visit[i][j] = True