LeetCode--Easy类题目
Disappear_XueChao
这个作者很懒,什么都没留下…
展开
-
9. Palindrome Number题目和答案详解
1 题目简述Determine whether an integer is a palindrome. Do this withoutextra space.判断一个整数是否为回文。这样做没有多余的空间。 Could negative integers be palindromes? (ie, -1)负数是否是回文数?(ie,-1) If you are thinkin原创 2017-11-30 21:53:49 · 528 阅读 · 0 评论 -
20. Valid Parentheses题目和答案详解
1 题目简述Given a string containing justthe characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.给定一个包含只字符'(', ')', '{', '}', '[' 和 ']'的字符串,确定输入字符串是否有效。The bracke原创 2018-01-10 21:17:24 · 773 阅读 · 0 评论 -
14. Longest Common Prefix题目和答案详解
1 题目简述Write a function to find the longestcommon prefix string amongst an array of strings.编写一个函数来查找字符串数组中最长的共同前缀字符串。2 答案详解(1) 解决思想 本次解答采用C++编写,C++相对于C语言的一个重要的特点是:面向对象编程(OOP),原创 2018-01-08 22:16:56 · 444 阅读 · 0 评论 -
26. Remove Duplicates from Sorted Array题目和答案详解
1 题目简述Given a sortedarray, remove the duplicates in-place such that each element appear only onceand return the new length.给定一个排序数组,删除重复的位置,使每个元素只出现一次,并返回新的长度。Do not allocateextra space for an原创 2018-01-17 15:29:43 · 630 阅读 · 0 评论 -
28. Implement strStr()题目和答案详解
1 题目简述Return the index of the first occurrence of needle inhaystack, or -1 if needle is not part of haystack.返回在haystack(为字符串)里第一次出现needle(同样为字符串)的索引,或者如果needle不是haystack的一部分,则返回-1。Example 1原创 2018-01-25 11:33:24 · 265 阅读 · 0 评论 -
21. Merge Two Sorted Lists题目和答案详解
1 题目简述Merge two sorted linked lists and return it as a newlist. The new list should be made by splicing together the nodes of the first two lists.合并两个已排序的链表并将其作为一个新列表返回。新列表应该通过拼接前两个列表的节点来完成。原创 2018-01-16 21:25:15 · 382 阅读 · 0 评论 -
27. Remove Element题目和答案详解
1 题目简述Givenan array and a value, remove all instances of that value in-place and return the new length.给定一个数组和一个值,删除该值的所有实例并返回新长度。Donot allocate extra space for another array, you must do th原创 2018-01-23 22:25:01 · 284 阅读 · 0 评论 -
13. Roman to Integer题目和答案详解
1 题目简述 Given aroman numeral, convert it to an integer. Input isguaranteed to be within the range from 1 to 3999. 给定一个罗马数字,将其转换为整数。 输入保证在1到3999的范围内。2 答案详解(1) 规则分析 首先,要知道罗马数字有7个:I原创 2017-11-27 22:46:10 · 729 阅读 · 0 评论 -
7.Reverse Integer题目和答案详解
1 题目简述 Given a 32-bit signed integer, reverse digits of an integer. 给定一个32位有符号整数,反转这个整型数。Example 1: Input: 123 Output: 321Example 2: Input: -123 Output: -321Example 3:原创 2017-11-23 11:08:11 · 1308 阅读 · 0 评论 -
1.Two Sum题目和答案详解
1题目简述给定一组整数,将两个数的返回指数相加,使它们相加成一个特定的目标。以下为所举的例子: Given nums = [2, 7, 11, 15], target = 9, Because nums[0] + nums[1] = 2 + 7 = 9, return [0, 1].2答案详解(1)解决思想给定一组整数,将两个数的返回指数相原创 2017-11-21 23:09:42 · 583 阅读 · 0 评论 -
35. Search Insert Position题目和答案详解
1 题目简述Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.给定一个排序数组和一个目标值,如果找到目标,就返回索引。如果原创 2018-02-03 12:21:35 · 195 阅读 · 0 评论