摘要:
vector generateParenthesis(int n) { // Note: The Solution object is instantiated only once and is reused by each test case. int left_cnt = n,right_cnt = n; vector res; dfs(left_cnt,right_cnt,"",res); return res; } void dfs(int left_cnt,int right_cnt,s... 阅读全文
posted @ 2013-10-06 14:22
summer_zhou
阅读(120)
评论(0)
推荐(0)
摘要:
ListNode *removeNthFromEnd(ListNode *head, int n) { // Note: The Solution object is instantiated only once and is reused by each test case. if(!head||nnext; while(fast->next) { fast = fast->next; prev = slow; slow = slow->next; ... 阅读全文
posted @ 2013-10-06 14:09
summer_zhou
阅读(137)
评论(0)
推荐(0)
摘要:
int uniquePathsWithObstacles(vector > &obstacleGrid) { // Start typing your C/C++ solution below // DO NOT write int main() function if(obstacleGrid[0][0]==1) return 0; int m = obstacleGrid.size(); int n = obstacleGrid[0].size(); vector> dp(m,... 阅读全文
posted @ 2013-10-06 13:48
summer_zhou
阅读(132)
评论(0)
推荐(0)
摘要:
bool isPalindrome(int x) { // Note: The Solution object is instantiated only once and is reused by each test case. if(x=10) { div*=10; } while(x) { int a = x/div; int b = x%10; if(a!=b) re... 阅读全文
posted @ 2013-10-06 09:48
summer_zhou
阅读(109)
评论(0)
推荐(0)
摘要:
考虑越界的问题 int reverse(int x) { // Note: The Solution object is instantiated only once and is reused by each test case. bool bNega = false; if(xINT_MAX) return (bNega?INT_MIN:INT_MAX); else return (bNega?-res:res); } 阅读全文
posted @ 2013-10-06 09:25
summer_zhou
阅读(169)
评论(0)
推荐(0)
浙公网安备 33010602011771号