11 2016 档案
摘要:Given two strings s and t which consist of only lowercase letters. String t is generated by random shuffling string s and then add one more letter at
阅读全文
摘要:Problem: Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the process
阅读全文
摘要:Problem: Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the f
阅读全文
摘要:最原始的方法:先排序,然后从头查找。若nums[i] = nums[i] + 1则为一对相同的数,i = i + 2,继续判断。若nums[i] != nums[i] + 1,则输出nums[i]。需注意不要越界! 通过参考别人的解题报告发现,可以使用异或运算:对所有元素做异或运算,其结果为那个出现
阅读全文
摘要:此题为技巧题,需知道Nim Game的Wining Strange,即在自己的局中,如果剩余数目为4的倍数,则不可能取胜。因此检测N是否为4的倍数即可。Background参见http://www.cdf.toronto.edu/~ajr/270/probsess/03/strategy.html
阅读全文

浙公网安备 33010602011771号