随笔分类 -  Job

摘要:代码: 1 class Solution { 2 public: 3 int atoi(string str) { 4 int num = 0; 5 int sign = 1; 6 const int n = str.size(); 7 ... 阅读全文
posted @ 2015-03-04 15:50 Azurewing 阅读(131) 评论(0) 推荐(0)
摘要:代码: 1 class Solution { 2 public: 3 void nextPermutation(vector &num) { 4 5 const auto first = num.begin(); 6 const auto last = nu... 阅读全文
posted @ 2015-03-04 15:25 Azurewing 阅读(145) 评论(0) 推荐(0)
摘要:代码:暴力算法 1 class Solution { 2 public: 3 int strStr(char *haystack, char *needle) { 4 if (!*needle) 5 return 0; 6 int al... 阅读全文
posted @ 2015-03-03 19:46 Azurewing 阅读(174) 评论(0) 推荐(0)
摘要:代码: 1 1 class Solution { 2 2 public: 3 3 int removeElement(int A[], int n, int elem) { 4 4 int index = 0; 5 5 for (int i = 0;... 阅读全文
posted @ 2015-03-03 10:25 Azurewing 阅读(180) 评论(0) 推荐(0)
摘要:代码:class Solution {public: bool isValid(string s) { string left = "([{"; string right = ")]}"; stack stk; for(auto c : ... 阅读全文
posted @ 2015-03-03 00:11 Azurewing 阅读(121) 评论(0) 推荐(0)
摘要:代码: 1 class Solution { 2 public: 3 bool isPalindrome(string s) { 4 transform(s.begin(), s.end(), s.begin(), ::tolower); 5 auto lef... 阅读全文
posted @ 2015-03-02 22:58 Azurewing 阅读(154) 评论(0) 推荐(0)
摘要:算法渣,现实基本都参考或者完全拷贝[戴方勤(soulmachine@gmail.com)]大神的leetcode题解,此处仅作刷题记录。 1 class Solution { 2 public: 3 vector > fourSum(vector &num, int target) ... 阅读全文
posted @ 2015-03-02 14:16 Azurewing 阅读(189) 评论(0) 推荐(0)
摘要:算法渣,现实基本都参考或者完全拷贝[戴方勤(soulmachine@gmail.com)]大神的leetcode题解,此处仅作刷题记录。 1 class Solution { 2 public: 3 int threeSumClosest(vector &num, int target) {... 阅读全文
posted @ 2015-03-01 21:16 Azurewing 阅读(147) 评论(0) 推荐(0)
摘要:算法渣,现实基本都参考或者完全拷贝[戴方勤(soulmachine@gmail.com)]大神的leetcode题解,此处仅作刷题记录。早先AC,现今TLEclass Solution {public: vector > threeSum(vector &num) { vecto... 阅读全文
posted @ 2015-03-01 20:44 Azurewing 阅读(151) 评论(0) 推荐(0)
摘要:算法渣,现实基本都参考或者完全拷贝[戴方勤(soulmachine@gmail.com)]大神的leetcode题解,此处仅作刷题记录。 1 class Solution { 2 public: 3 vector twoSum(vector &numbers, int target) { 4... 阅读全文
posted @ 2015-03-01 18:59 Azurewing 阅读(193) 评论(0) 推荐(0)