摘要:
LeetCode 242 Valid Anagram由于都是小写字母,可以建立一个长度为26的数组来记录每个字母出现的次数。C语言实现如下:bool isAnagram(char* s, char* t) { if(strlen(s)!=strlen(t)) return 0; ... 阅读全文
posted @ 2015-11-14 10:17
Walker_Lee
阅读(146)
评论(0)
推荐(0)
摘要:
LeetCode 171 Excel Sheet Column Numberc语言实现:int titleToNumber(char* s) { int num = 0; char c; while(c = *s++) { num = num*26 + c - ... 阅读全文
posted @ 2015-11-14 09:30
Walker_Lee
阅读(114)
评论(0)
推荐(0)
摘要:
LeetCode 217 Contains Duplicate一种C++实现,先排序,再比较相邻值是否相等:class Solution {public: bool containsDuplicate(vector& nums) { std::sort(nums.begin(),... 阅读全文
posted @ 2015-11-14 09:07
Walker_Lee
阅读(126)
评论(0)
推荐(0)

浙公网安备 33010602011771号