原创 【Python】常用文件操作

對文件內容操作: file= open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=No

原创 【Python】解壓zip文件

遞歸遍歷並解壓zip中所有.doc,.docx和.pdf: def unzip_report(zip_name): with zipfile.ZipFile(zip_name,'r') as z: name

原创 【Linux】編譯C++文件命令

gcc -o test test.cpp

原创 vim配置文件.vimrc——設置tab爲4格

在用戶home目錄下創建.vimrc文件,然後輸入以下配置: set tabstop=4 set sw=4 set noexpandtab set autoindent

原创 我的第一個Makefile文件

$(warning "outer0") TMP=./tmp/ BIN=./bin/ test=test all: test2 # 默認入口,然後按順序執行。注:執行完全局的命令之後,纔會轉到此處執行。有all的時候,會嚴格

原创 將Markdown格式文件轉換爲PDF文件

利用Windows版本的Typora即可。 參考: https://www.zhihu.com/question/20849824

原创 Google 開源項目風格指南——C++ 風格指南

Google 開源項目風格指南——C++ 風格指南

原创 【leetcode】367. Valid Perfect Square

題目: Given a positive integer num, write a function which returns True if num is a perfect square else False. Follow

原创 【leetcode】355. Design Twitter

題目: 思路: 數據結構解釋如下: Tweet: 推特消息,以list的形式存放。一個Tweet就是一個list node,包含id,time以及next指針。 User: 用戶,實體對象。其中包含用戶id、存放訂閱用戶的un

原创 【leetcode】334. Increasing Triplet Subsequence

題目: 思路: 抄作業https://www.cnblogs.com/warmland/p/5735208.html。 用x和y保存序列中所有nums[i]<nums[j]中nums[j]最小的那一對。兩個變量的解釋如下: x

原创 【leetcode】337. House Robber III

題目: The thief has found himself a new place for his thievery again. There is only one entrance to this area, called

原创 【leetcode】341. Flatten Nested List Iterator

題目: Given a nested list of integers, implement an iterator to flatten it. Each element is either an integer, or a l

原创 【leetcode】349. Intersection of Two Arrays

題目: Given two arrays, write a function to compute their intersection. 思路: 利用unordered_map<int, bool> my_map保存nums1

原创 【leetcode】357. Count Numbers with Unique Digits

題目: 思路: 規律如下: f(0)=1 f(1)=10 f(2)=9*9+f(1) f(3)=9*9*8+f(2) f(4)=9*9*8*7+f(3) f(5)=9*9*8*7*6+f(4) f(6)=9*9*8*7*6*5

原创 【leetcode】342. Power of Four

題目: Given an integer (signed 32 bits), write a function to check whether it is a power of 4. 思路: (num&(num-1))==0保