
LeetCode
爱吃菜的汪
快点去学习
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Leetcode-26-从排序数组中删除重复项
Given a sorted array, remove the duplicates in-place such that each element appear only once and return the new length. Do not allocate extra space for another array, you must do this by modifyin原创 2017-11-30 17:31:53 · 16610 阅读 · 4 评论 -
leetcode-65-有效的数字
验证给定的字符串是否为数字。 这个题最恶心之处在于给你的样例太少,而实际中的情况却非常复杂。很多很多意想不到的情况,不断地WA...... 这个题做的人难受的一批,查了一下还是我太嫩了,大佬们都是用有限状态机来做的(不会、不存在的、下一个...)...... 下面是AC代码: import java.util.Scanner; public class leetcode6原创 2017-11-30 17:44:52 · 402 阅读 · 1 评论 -
leetcode-14-最长公共前缀
Write a function to find the longest common prefix string amongst an array of strings. 题意为编写一个函数来查找字符串数组中最长的公共前缀字符串。 这道题并不难想,首先对传入的字符串数组进行排序,然后只需要对比第一个与最后一个字符串,即可得到最长公共前缀了。 代码: import ja原创 2017-11-23 18:31:27 · 555 阅读 · 1 评论