
LeetCode解答
BryanMelody
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
【LeetCode解答三】Longest Substring Without Repeating Characters问题Java解答
Given a string, find the length of the longest substring without repeating characters.Examples:Given “abcabcbb”, the answer is “abc”, which the length is 3.Given “bbbbb”, the answer is “b”, with the le原创 2017-09-04 21:26:19 · 379 阅读 · 0 评论 -
【LeetCode解答四】Median of Two Sorted Arrays问题Java解答
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 complexity should be O(log (m+n)).Example 1:nums1 = [1, 3]nums2原创 2017-09-06 19:49:02 · 419 阅读 · 0 评论 -
【LeetCode解题一】Two Sum问题Java解答
Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use the same ele原创 2017-09-03 16:48:22 · 869 阅读 · 0 评论 -
【LeetCode解答二】Add Two Numbers问题Java解答
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it原创 2017-09-03 17:00:54 · 557 阅读 · 0 评论 -
【LeetCode解答五】Palindrome Number问题Java解答
Determine whether an integer is a palindrome. Do this without extra space.就是回文数,非常简单,用转换为String类型的来做,速度会有点慢,不如直接取余取除运算效率高直接贴代码package Q9PalindromeNumber;import java.util.Scanner;/** * @author 单继重 * @原创 2017-11-02 16:47:07 · 326 阅读 · 0 评论 -
【LeetCode解答六】Integer to Roman问题Java解答
Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.以上是题目要求 想做这道题必须要明白罗马数字是怎么写的 阿拉伯数字 罗马数字 1 I 4 IV 5 V 9原创 2017-11-02 19:24:01 · 448 阅读 · 0 评论 -
【LeetCode解答七】Roman to Integer问题Java解答
Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.跟上一题类似,上一题是阿波罗数字转罗马数字,这题是罗马数字转阿拉伯数字,我写的思路是一样的,都是遍历字符串,比较其中一个或两个和罗马数字中是否一致,如果一致便与相应数字相加,得出结果,其中有原创 2017-11-03 10:37:01 · 474 阅读 · 0 评论 -
【LeetCode解答八】Longest Common Prefix问题Java解答
Write a function to find the longest common prefix string amongst an array of strings.以上就是题目要求,非常简单,找出所有字符串的最长共有前缀,那就找呗,很简单一道题package Q14LongestCommonPrefix;/** * @author 单继重 * @since 2017/11/3 10:39原创 2017-11-03 10:57:48 · 756 阅读 · 0 评论 -
【LeetCode解答九】Valid Parentheses问题Java解答
Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[’ and ‘]’, determine if the input string is valid.The brackets must close in the correct order, “()” and “()[]{}” are all valid but “原创 2017-11-13 20:52:26 · 449 阅读 · 0 评论