Unable to install Homebrew with this? ruby -e "\$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)" What’s happened -e:70: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777 ==> This script will install: /usr/local/bin/brew /usr/local/Library/... /usr/…

Question Given a number, find the number of 1 in the number’s binary expression. For example, binary express of 10 is 1010. So the number of 1 in it is 2. Solution To solve this, we can check each bit by shifting the bits one by one. 1010 -&…

Question Given a string, write an algorithm to find the character inside that appeared only once. For example, the result for string “abaccdeff” is b. Solution We can use a hashtable to count the appearance times for each character. Then rescan the hashtable for the character that appeared only once.…

Question Given a linked list, find the Kth last node in a linked list. The last 0th node is the tail node in the linked list. Solution Easy task. Construct 2 pointers: P1 and P2. First, both of them are set to head. Move P2 to the next Kth node.…

Question Sum up 1 to n without using division, multiplication, for loop, while loop, if else, switch and condition statement (A?B:C). Solution 1 Actually, for loop can be simulated through making use of the static property. Since static value will be stored in the class, we can increase…

Question 腾讯面试题： 给你10分钟时间，根据上排给出十个数，在其下排填出对应的十个数 要求下排每个数都是先前上排那十个数在下排出现的次数。 上排的十个数如下： 【0，1，2，3，4，5，6，7，8，9】 Solution 初看此题，貌似很难，10分钟过去了，可能有的人，题目都还没看懂。 举一个例子， 数值: 0,1,2,3,4,5,6,7,8,9 分配: 6,2,1,0,0,0,1,0,0,0 0在下排出现了6次，1在下排出现了2次， 2在下排出现了1次，3在下排出现了0次……

Actually, this website was my portfolio webpage before becoming a wordpress. It is moved to here: nicholasworkshop.com/portfolio. Using wordpress, I put the old webpage aside and always forgot to transfer the information from it to the front page. Anyway, I hope this can remind me of the projects…

Today, I moved my nicholasworkshop.wordpress.com to my owned domain nicholasworkshop.com, integrated with my old portfolio website. Thanks to my subscribers, my blog has been having a steady viewing rate over time. However, all those traffics went to wordpress.com as the blog was hosted there. To redirect…

Happy lunar new year to all. I am flattered. In less than a month since I put the InstaMusic to the Android Market on 27 Dec 2011, today it has already more than 10,000 downloads. To be honest, I never expected this. If you are uninitialized, InstaMusic is a…