2018年11月8日

摘要: 比如有如下网址的文件需要下载: 将其放入一个文件中(例如 url) 我们可以使用 awk + shell 每次读取一行,然后 wget 相应的文件:`awk '{cmd="wget "$0;system(cmd)}' url` 阅读全文
posted @ 2018-11-08 15:23 Haikyuu 阅读(554) 评论(0) 推荐(0)

2018年10月25日

摘要: "922. Sort Array By Parity II" 题目描述 Given an array A of non negative integers, half of the integers in A are odd, and half of the integers are even. S 阅读全文
posted @ 2018-10-25 09:36 Haikyuu 阅读(306) 评论(0) 推荐(0)

2018年10月13日

摘要: "104. Maximum Depth of Binary Tree Easy" 方法 使用递归 Time complexity : we visit each node exactly once, thus the time complexity is \mathcal{O}(N)O(N), wh 阅读全文
posted @ 2018-10-13 16:16 Haikyuu 阅读(123) 评论(0) 推荐(0)
摘要: "136. Single Number Easy" 解答 相同的数,XOR 等于 0,所以,将所有的数字 XOR 就可以得到只出现一次的数 c++ class Solution { public: int singleNumber(vector& nums) { int s = 0; for(int 阅读全文
posted @ 2018-10-13 15:59 Haikyuu 阅读(111) 评论(0) 推荐(0)
摘要: "852. Peak Index in a Mountain Array Easy" 方法一:二分查找 官方答案: java class Solution { public int peakIndexInMountainArray(int[] A) { int lo = 0, hi = A.leng 阅读全文
posted @ 2018-10-13 15:14 Haikyuu 阅读(240) 评论(0) 推荐(0)