2014年5月29日

LeetCode --- Valid Palindrome

摘要: 题目链接判断字符串是否为回文串。附上代码: 1 class Solution { 2 public: 3 bool isPalindrome(string s) { 4 if (s.empty()) return true; // consider empty string ... 阅读全文

posted @ 2014-05-29 21:54 Stomach_ache 阅读(132) 评论(0) 推荐(0)

LeetCode --- Longest Consecutive Sequence

摘要: 题目链接对unordered_set和set的内部实现还不了解,只知道前者是hash实现的,后者是用R-B-Tree实现。有时间需要读下源码。附上代码: 1 class Solution { 2 public: 3 int longestConsecutive(vector &num) { ... 阅读全文

posted @ 2014-05-29 12:28 Stomach_ache 阅读(108) 评论(0) 推荐(0)

LeetCode --- Insertion Sort List

摘要: 题目链接实现链表的插入排序附上代码: 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ListNode(i... 阅读全文

posted @ 2014-05-29 01:24 Stomach_ache 阅读(126) 评论(0) 推荐(0)

导航