摘要: 题目: Implement atoi to convert a string to an integer. 题目大意: 将一个数字字符串转化为整数数字,返回整数数字。 思路: 初看本题觉得很简单,直接用一个循环进行转换就行了,循环里边的语句也很简单,就是result = resul... 阅读全文
posted @ 2016-04-05 19:53 Jung_zhang 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 题目: Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 题目大意: 逆置一个整数,如:123--->321 -123--->-321 思路: ... 阅读全文
posted @ 2016-04-04 18:41 Jung_zhang 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 题目: The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in ... 阅读全文
posted @ 2016-04-04 15:19 Jung_zhang 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one un... 阅读全文
posted @ 2016-04-03 21:14 Jung_zhang 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 题目: There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time co... 阅读全文
posted @ 2016-03-31 23:53 Jung_zhang 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 题目: Given an unsorted array of integers, find the length of longest increasing subsequence. For example, Given [10, 9, 2, 5, 3, 7, 101, 18], The l... 阅读全文
posted @ 2016-03-30 19:03 Jung_zhang 阅读(207) 评论(0) 推荐(0) 编辑
摘要: 题目: 将两个等长有序数组的中位数,要求时间复杂度为O(logn)。 思路: 大体思想是:比较两个数组的中位数 (1)、如果相同则该值就是中位数 (2)、如果num1 num2则中位数位于num1的前半部分或num2的后半部分 (4)、一直执行(2)和(3)直到数... 阅读全文
posted @ 2016-03-29 22:08 Jung_zhang 阅读(1714) 评论(0) 推荐(0) 编辑
摘要: 1、单链表中间结点 问:如何快速查找定位到一条单链表的中间结点? 答:(1)、可以将链表中的所有结点遍历一遍得到总个数,再查找到中间结点(这不废话嘛,这么low的答案就不拉出来献丑了=、=) (2)、可以使用快慢指针法,一个指针一倍速率遍历,另一个指针两倍速率遍历链表,当第一个走到末尾时第二... 阅读全文
posted @ 2016-03-28 23:45 Jung_zhang 阅读(181) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating le... 阅读全文
posted @ 2016-03-28 23:32 Jung_zhang 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 题目: You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a... 阅读全文
posted @ 2016-03-27 15:55 Jung_zhang 阅读(123) 评论(0) 推荐(0) 编辑