摘要: class Solution { public: string convert(string s, int nRows) { if (nRows <= 1) return s; string res = ""; int size = 2 * nRows - 2; for (int i = 0; i 阅读全文
posted @ 2017-01-29 20:24 王坤1993 阅读(243) 评论(0) 推荐(0)
摘要: // Time complexity O(n*n) class Solution { public: string longestPalindrome(string s) { int startIdx = 0, left = 0, right = 0, len = 0; for (int i = 0 阅读全文
posted @ 2017-01-29 20:20 王坤1993 阅读(148) 评论(0) 推荐(0)
摘要: class Solution { public: double findMedianSortedArrays(vector<int>& nums1, vector<int>& nums2) { int total = nums1.size() + nums2.size(); if (total % 阅读全文
posted @ 2017-01-29 20:19 王坤1993 阅读(140) 评论(0) 推荐(0)
摘要: class Solution { public: int lengthOfLongestSubstring(string s) { int m[256] = {0}, res = 0, left = 0; for (int i = 0; i < s.size(); ++i) { if (m[s[i] 阅读全文
posted @ 2017-01-29 20:18 王坤1993 阅读(131) 评论(0) 推荐(0)