摘要: 指定位置后插入行 sed -i '/match reg/a\line1\nline2' target.txt 指定位置前插入行 sed -i '/match reg/i\line1\nline2' target.txt 阅读全文
posted @ 2018-08-08 10:58 lennyT 阅读(229) 评论(0) 推荐(0)
摘要: Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. 阅读全文
posted @ 2018-07-19 23:22 lennyT 阅读(75) 评论(0) 推荐(0)
摘要: Given an unsorted array of integers, find the length of the longest consecutive elements sequence. Your algorithm should run in O(n) complexity. Examp 阅读全文
posted @ 2018-07-16 22:08 lennyT 阅读(71) 评论(0) 推荐(0)
摘要: Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpo 阅读全文
posted @ 2018-07-14 12:01 lennyT 阅读(96) 评论(0) 推荐(0)
摘要: Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. Note: The algorithm should run in linear time and in O(1) spa 阅读全文
posted @ 2018-07-13 17:31 lennyT 阅读(156) 评论(0) 推荐(0)
摘要: Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -. Example:Given a = 1 and b = 2, return 3. Reference: ht 阅读全文
posted @ 2018-07-09 23:05 lennyT 阅读(85) 评论(0) 推荐(0)
摘要: Given an unsorted array of integers, find the length of longest increasing subsequence. Example: Note: There may be more than one LIS combination, it 阅读全文
posted @ 2018-07-07 20:38 lennyT 阅读(90) 评论(0) 推荐(0)
摘要: You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you nee 阅读全文
posted @ 2018-07-07 11:35 lennyT 阅读(88) 评论(0) 推荐(0)
摘要: 一、服务端 1、设置rsync配置文件 max connections = 10 pid file = /home/user/rsync/rsyncd.pid lock file = /home/user/rsync/rsyncd.lock log file = /home/user/rsync/r 阅读全文
posted @ 2018-07-05 19:56 lennyT 阅读(523) 评论(0) 推荐(0)
摘要: Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted i 阅读全文
posted @ 2018-07-03 23:14 lennyT 阅读(75) 评论(0) 推荐(0)