
leetcode-java
文章平均质量分 54
我菜
这个作者很懒,什么都没留下…
展开
-
LeetCode 65 — Valid Number(java)
题目链接 Validate if a given string is numeric. Examples: “0” => true ” 0.1 ” => true “abc” => false “1 a” => false “2e10” => true 翻译 验证给定的字符串是否为数字。 分析 最开始看到这个的时候就觉得很简单,为什么会是个hard,在每次提交原创 2017-11-21 20:53:50 · 699 阅读 · 0 评论 -
LeetCode 26 — Remove Duplicates from Sorted Array(Java)
题目 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-20 23:06:29 · 181 阅读 · 0 评论 -
LeetCode 14 — Longest Common Prefix (Java)
题目链接 Write a function to find the longest common prefix string amongst an array of strings. 翻译 在字符串数组中找到最长的公共前缀。 分析 思路:当时的想法是找出最短的,它本身或者它的某一部分就是最长的公共前缀 1. 将字符串数组排序,最短的在第一个作为参考 2. 遍历,从第二原创 2017-11-21 19:33:13 · 249 阅读 · 0 评论 -
编程题 求树的高度
题目 现在有一棵合法的二叉树,树的节点都是用数字表示,现在给定这棵树上所有的父子关系,求这棵树的高度 输入 输入的第一行表示节点的个数n(1<=n<=1000,节点的编号为0到n-1)组成, 下面是n-1行,每行有两个整数,第一个数表示父节点的编号,第二个数表示子节点的编号 输出 输出树的高度,为一个整数 样例输入 5原创 2017-11-23 17:48:55 · 1280 阅读 · 0 评论