摘要: Description:Given a linked list, swap every two adjacent nodes and return its head.For example,Given1->2->3->4, you should return the list as2->1->4->... 阅读全文
posted @ 2015-06-14 20:36 Rosanne 阅读(152) 评论(0) 推荐(0) 编辑
摘要: Description:Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lis... 阅读全文
posted @ 2015-06-14 20:17 Rosanne 阅读(148) 评论(0) 推荐(0) 编辑
摘要: Description:Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321Code: 1 int reverse(int x) { 2 int p=0; 3... 阅读全文
posted @ 2015-06-14 19:57 Rosanne 阅读(207) 评论(0) 推荐(0) 编辑
摘要: Description:Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices o... 阅读全文
posted @ 2015-06-14 13:19 Rosanne 阅读(167) 评论(0) 推荐(0) 编辑
摘要: Description:You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes conta... 阅读全文
posted @ 2015-06-14 13:15 Rosanne 阅读(175) 评论(0) 推荐(0) 编辑
摘要: Description:A robot is located at the top-left corner of amxngrid (marked 'Start' in the diagram below).The robot can only move either down or right a... 阅读全文
posted @ 2015-06-14 10:17 Rosanne 阅读(164) 评论(0) 推荐(0) 编辑
摘要: Description:Given a stringsconsists of upper/lower-case alphabets and empty space characters' ', return the length of last word in the string.If the l... 阅读全文
posted @ 2015-06-14 10:07 Rosanne 阅读(232) 评论(0) 推荐(0) 编辑
摘要: Description:Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array[−2,1,... 阅读全文
posted @ 2015-06-14 09:57 Rosanne 阅读(143) 评论(0) 推荐(0) 编辑
摘要: Description:You are given annxn2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?Code: 1... 阅读全文
posted @ 2015-06-14 09:47 Rosanne 阅读(124) 评论(0) 推荐(0) 编辑
摘要: Description:Given a collection of numbers, return all possible permutations.For example,[1,2,3]have the following permutations:[1,2,3],[1,3,2],[2,1,3]... 阅读全文
posted @ 2015-06-14 09:36 Rosanne 阅读(302) 评论(0) 推荐(0) 编辑
摘要: Description:Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It... 阅读全文
posted @ 2015-06-14 09:11 Rosanne 阅读(185) 评论(0) 推荐(0) 编辑
摘要: Description:Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets must close in ... 阅读全文
posted @ 2015-06-14 09:02 Rosanne 阅读(158) 评论(0) 推荐(0) 编辑