![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode
no_Talents
算法好难- -
展开
-
LeetCode | 27. Remove Element
Given an array nums and a value val, remove all instances of that value in-place and return the new length.Do not allocate extra space for another array, you must do this by modifying the input array...原创 2019-01-10 20:19:39 · 107 阅读 · 0 评论 -
LeetCode | 35. Search Insert Position
题目提供一个已排序且没有重复数字的数组和一个目标值,如果在数组中找到目标值则返回目标值的下标,如果找不到则返回该目标值可能存在的下标位置。例子 1输入: [1,3,5,6], 5输出: 2例子 2输入: [1,3,5,6], 2输出: 1例子 3输入: [1,3,5,6], 7输出: 4例子 4输入: [1,3,5,6], 0输出: 0题解遍历数组,只要目标值...原创 2019-01-11 00:34:31 · 100 阅读 · 0 评论 -
LeetCode | 14. 最长公共前缀
题目编写一个函数来查找字符串数组中的最长公共前缀。如果不存在公共前缀,返回空字符串 “”。示例 1:输入: ["flower","flow","flight"]输出: "fl"示例 2:输入: ["dog","原创 2019-01-12 22:08:08 · 152 阅读 · 0 评论 -
LeetCode | 9. Palindrome Number
Determine whether an integer is a palindrome(回文). An integer is a palindrome when it reads the same backward as forward.Example 1:Input: 121Output: trueExample 2:Input: -121Output: falseExplan...原创 2019-01-08 16:20:35 · 110 阅读 · 0 评论 -
LeetCode | 20. Valid Parentheses
Given a string containing just the characters ‘(’, ‘)’, ‘{’, ‘}’, ‘[’ and ‘]’, determine if the input string is valid.An input string is valid if:Open brackets must be closed by the same type of bra...原创 2019-01-08 23:22:19 · 94 阅读 · 0 评论 -
LeetCode | 13. Roman to Integer
Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.Symbol ValueI 1V 5X 10L 50C 100D ...原创 2019-01-09 17:55:14 · 110 阅读 · 0 评论 -
LeetCode | 58. 最后一个单词的长度
题目给定一个仅包含大小写字母和空格 ’ ’ 的字符串,返回其最后一个单词的长度。如果不存在最后一个单词,请返回 0 。说明一个单词是指由字母组成,但不包含任何空格的字符串。示例输入: "Hello World"输出: 5题解先去掉字符串的头尾空格,再从尾部开始扫描。class Solution { public int lengthOfLastWord(String ...原创 2019-01-17 00:01:10 · 153 阅读 · 0 评论