Other articles

  1. Install x11vnc on deepin Linux

    First of all, the deepin distribution of Linux is very pretty! I like the color scheme, icon design, control panel design, etc. Since the main feature of deepin is desktop design, I really want to use its desktop from my remote machines if bandwidth is fine.

    I used to access ...

    read more
  2. mutt is a good email command!


    I have some thing stored on my office computer, but it is not simple to access from outside. The only way is using jump machine by ssh. If I want to get some files out, I must send it to jump machine and then fetch it.

    If the file ...

    read more
  3. 150 Years of Sun Yat-sen

    孙中山先生诞辰 150 周年

    实际上我对于孙先生的生平并不十分了解,很多所知都是来自于影视剧中的片段。 不过,总还是有些感慨:150年了呢,孙先生所在的那个时代,不在其中难以想象其动荡, 但总是会感觉,即便身在现在,自己有看到现在的时代潮流和未来走向吗? 自觉不能。所以,十分佩服,在时代中看准方向,坚持,妥协,不屈,探索,走完自己不悔的一生。

    read more
  4. LeetCode: 421. Maximum XOR of Two Numbers in an Array

    The problem is https://leetcode.com/problems/maximum-xor-of-two-numbers-in-an-array/. If just follow the process defined as described in problem, it is quite simple except the runtime is O(n**2):

    class Solution(object):
        def findMaximumXOR(self, nums):
            :type nums: List[int]
            :rtype: int
            if len(nums)<2:
                return 0
            ret = nums ...
    read more
  5. LeetCode: 401. Binary Watch

    The problem is https://leetcode.com/problems/binary-watch/. Because the input size is limited, generating every output is workable. Simplely follow the input, using itertools could generate all combinations.

    import itertools
    digitals = [8, 4, 2, 1, 32, 16, 8, 4, 2, 1]
    def get_xtime(ps):
        h = 0
        m = 0
        for ...
    read more
  6. The ThinkPad X60/61 Series Are Really Classical

    Recently I received an old ThinkPad X61 body, which has a broken screen, lacks battery, bad memory, slow hdd and broken surface C. After bought some accessories, I re-installed a Xubuntu 16.04 system on it. Even at present, the design of this laptop is in fashion. All four borders ...

    read more
  7. LeetCode: 195. Tenth Line

    The problem is here: https://leetcode.com/problems/tenth-line/. It's a bash programming, reading the 10th line of a file and output in stdout. I think there are lots of methods to do this, here I write some.

    If the file has more than 10 lines, I can output ...

    read more
  8. LeetCode: 112. Path Sum

    The problem is here: https://leetcode.com/problems/path-sum/ . Fancy that the number can be negative numbers, I made a stupid 'optimization'. I added a piece of code to check whether current node value is bigger than sum, assuming that every node value is positive. After droping this 'optimization', it ...

    read more
  9. LeetCode: 201. Bitwise AND of Numbers Range

    The problem is here: https://leetcode.com/problems/bitwise-and-of-numbers-range/ . I simply wrote a silly version and failed as expected, it just did exactly as this problem described.

    class Solution(object):
        def rangeBitwiseAnd(self, m, n):
            Attention! This is a bad version!
            :type m: int
            :type n: int
            :rtype: int
            return ...
    read more

Page 1 / 4 »