原创 [LeetCode] Single Number

Given an array of integers, every element appears twice except for one. Find that single one. Could you implement it

原创 [LeetCode] Word Ladder

Given two words (beginWord and endWord), and a dictionary, find the length of shortest transformation sequence from b

原创 [LeetCode] Populating Next Right Pointers in Each Node

Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode

原创 GNUPLOT linespoints and save as pdf

set terminal postscript eps enhanced color font ',30' set yrange [0:1] set logscale x set xrange [200:100000] set grid

原创 TOP用法

1. 查詢某個進程iperf的cpu使用率,每隔1s輸出一次,一共輸出10次 top  -b -n10 -d 1 -p `pgrep iperf`>> file.txt

原创 [LeetCode] Contains Duplicate

Given an array of integers, find if the array contains any duplicates. Your function should return true if any value ap

原创 [LeetCode] Distinct Subsequences

Given a string S and a string T, count the number of distinct subsequences of T in S. A subsequence of a string is a

原创 [LeetCode]Implement Trie (Prefix Tree)

class TrieNode { public: // Initialize your data structure here. TrieNode() { val='0';

原创 [LeetCode] HouseRobber

You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed,

原创 [python] Lift is short, I need python!

Example 1: Reverse words in a String Given an input string, reverse the string word by word. For example, Given s =

原创 Matlab 命令行設置顏色和legend,保存圖像,設置title。。。

i=10; goodput=(i-1)*5+2; rtt=goodput+1; lossrate=rtt+1; qpm=lossrate+1; total_request=qpm+1; figure h6=plot(asn12322_sm

原创 寫在受洗之前:我爲什麼成爲基督徒

      暑假在灣區實習,參加歸正教會的聚會,有時也會訝異:我這樣一個仍然被花花世界羈絆的大俗人怎麼開始想要親近主,嚮往過敬虔的生活了。下週要受洗了,渴望這一天好久,在受洗之前想來梳理一下這半年的“心路”,爲主作見證。對很驚訝我信主的

原创 GNUPLOT bar plot 繪製,並用條紋填充

set terminal postscript font "Helvetica, 16" set boxwidth 0.9 absolute set style fill pattern 2 border lt -1 set style

原创 [LeetCode] Merge K sorted lists

Solution 1: 1. use merge2list(), and merge all lists one by one. Time complexity is O(n*longest list length) 2. For eac

原创 將文件夾下所有pdf變成黑白的腳本

#!/bin/bash for file in ./*.pdf do echo "$file" gs -o black+white.pdf -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -sC