
Leetcode刷题之旅
分享Leetcode的个人题解,思路,心得
Lawliet_ZMZ
ACMERandNODER
展开
-
leetcode32 Longest Valid Parentheses 最长有效括号序列
题目:Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.For "(()", the longest valid parentheses substring is "()", w原创 2017-10-05 22:01:21 · 393 阅读 · 0 评论 -
14. Longest Common Prefix 最长公共前缀子串
14. Longest Common PrefixDescriptionHintsSubmissionsDiscussSolution DiscussPick One Write a function to find the longest common prefix string amongst an arra原创 2017-10-27 19:54:23 · 372 阅读 · 0 评论 -
49. Group Anagrams
Given an array of strings, group anagrams together.For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"], Return:[ ["ate", "eat","tea"], ["nat","tan"], ["bat"]] Note: A原创 2017-11-04 00:19:36 · 188 阅读 · 0 评论 -
leetcode31. Next Permutation 求下一个最小的字典序序列
Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possible, it must rearrange it as the lowest possible o原创 2018-02-02 05:45:34 · 533 阅读 · 0 评论 -
leetcode19. Remove Nth Node From End of List
Given a linked list, remove the nth node from the end of list and return its head.For example,Given linked list: 1->2->3->4->5, and n = 2.After removing the second node from the end, the linked原创 2018-02-02 05:47:46 · 176 阅读 · 0 评论 -
leetcode11. Container With Most Water
Given n non-negative integers a1, a2, …, an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two li原创 2018-02-02 05:48:45 · 155 阅读 · 0 评论 -
leetcode6. ZigZag Conversion
ZigZag Conversion DescriptionHintsSubmissionsDiscussSolutionDiscussPick OneThe string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this: (you may want to displa原创 2018-02-02 05:52:37 · 216 阅读 · 0 评论 -
leetcode5. Longest Palindromic Substring
Longest Palindromic Substring DescriptionHintsSubmissionsDiscussSolutionDiscussPick OneGiven a string s, find the longest palindromic substring in s. You may assume that the maximum length of s原创 2018-02-02 05:58:33 · 188 阅读 · 0 评论 -
leetcode3. Longest Substring Without Repeating Characters
Longest Substring Without Repeating Characters DescriptionHintsSubmissionsDiscussSolutionDiscussPick OneGiven a string, find the length of the longest substring without repeating characters.Ex原创 2018-02-02 06:00:54 · 290 阅读 · 0 评论 -
leetcode2. Add Two Numbers
Add Two Numbers DescriptionHintsSubmissionsDiscussSolutionDiscussPick OneYou are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order a原创 2018-02-02 06:02:35 · 218 阅读 · 0 评论 -
leetcode260. Single Number III
Single Number III DescriptionHintsSubmissionsDiscussSolutionDiscussPick OneGiven an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactl原创 2018-02-02 06:03:50 · 176 阅读 · 0 评论 -
leetcode137. Single Number II
Single Number II DescriptionHintsSubmissionsDiscussSolutionDiscussPick OneGiven an array of integers, every element appears three times except for one, which appears exactly once. Find that sing原创 2018-02-02 06:06:51 · 226 阅读 · 0 评论 -
leetcode136. Single Number 亦或Xor原理
以前tao哥就讲过,在Leetcode里面分类是一个Easy的问题。public class Solution { public int singleNumber(int[] nums) { int ans = 0; for(int e : nums) { ans ^= e;原创 2018-02-02 06:08:06 · 265 阅读 · 0 评论