LeetCode刷题
不升级的小怪兽
这个作者很懒,什么都没留下…
展开
-
LeetCode1. Two Sum(两数之和)
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. Example: Given nums = [2, 7, ...原创 2018-12-20 08:31:26 · 185 阅读 · 0 评论 -
LeetCode7. Reverse Integer(翻转整数)
Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 给出一个 32 位的有符号整数,你需要将这个整数中每位上的数字进行反转。 示例 1:输入: 123 输出: 321 示例 2:输入: -123 输出: -321 public class Solut...原创 2018-12-20 09:03:19 · 153 阅读 · 0 评论 -
LeetCode20. Valid Parentheses(有效括号)
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 bu...原创 2018-12-21 09:43:27 · 112 阅读 · 0 评论 -
LeetCode203.Remove Linked List Elements( 删除链表中的节点)
Remove all elements from a linked list of integers that have value val. Example Given: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6 Return: 1 --> 2 --> 3 --> 4 --...原创 2018-12-21 14:35:43 · 115 阅读 · 0 评论 -
LeetCode349.Intersection of Two Arrays(两个数组的交集)
Given two arrays, write a function to compute their intersection. Example 1: Input: nums1 = [1,2,2,1], nums2 = [2,2] Output: [2] Example 2: Input: nums1 = [4,9,5], nums2 = [9,4,9,8,4] Output: [...原创 2018-12-23 19:05:48 · 89 阅读 · 0 评论 -
LeetCode350.Intersection of Two Arrays II(两个数组的交集 II)
Given two arrays, write a function to compute their intersection. Example 1: Input: nums1 = [1,2,2,1], nums2 = [2,2] Output: [2,2] Example 2: Input: nums1 = [4,9,5], nums2 = [9,4,9,8,4] Outp...原创 2018-12-23 18:58:11 · 99 阅读 · 0 评论 -
Leetcode804.Unique Morse Code Words (莫尔斯电码重复)
International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows: "a" maps to ".-", "b" maps to "-...", "c" maps to "-.-.", and so on. F原创 2018-12-23 19:48:58 · 212 阅读 · 0 评论