随笔分类 -  leetcode

摘要:Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring. Example 1: Input: 阅读全文
posted @ 2020-02-14 20:42 hyx1 阅读(102) 评论(0) 推荐(0)
摘要:Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possib 阅读全文
posted @ 2020-02-14 18:34 hyx1 阅读(103) 评论(0) 推荐(0)
摘要:Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, a solution set is: [ 阅读全文
posted @ 2020-02-14 17:01 hyx1 阅读(95) 评论(0) 推荐(0)
摘要:Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. Example: 阅读全文
posted @ 2020-02-13 20:05 hyx1 阅读(81) 评论(0) 推荐(0)
摘要:Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: Op 阅读全文
posted @ 2020-02-13 19:58 hyx1 阅读(131) 评论(0) 推荐(0)
摘要:Given a linked list, remove the n-th node from the end of list and return its head. Example: Given linked list: 1->2->3->4->5, and n = 2. After removi 阅读全文
posted @ 2020-02-13 19:35 hyx1 阅读(116) 评论(0) 推荐(0)
摘要:Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. A mapping of digit to le 阅读全文
posted @ 2020-02-13 19:12 hyx1 阅读(134) 评论(0) 推荐(0)
摘要:Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the s 阅读全文
posted @ 2020-02-12 12:41 hyx1 阅读(103) 评论(0) 推荐(0)
摘要: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 endp 阅读全文
posted @ 2020-02-12 10:36 hyx1 阅读(107) 评论(0) 推荐(0)
摘要:Given an input string (s) and a pattern (p), implement regular expression matching with support for '.' and '*'. '.' Matches any single character. '*' 阅读全文
posted @ 2020-02-02 21:23 hyx1 阅读(158) 评论(0) 推荐(0)
摘要:Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example 1: Input: "babad" Output: 阅读全文
posted @ 2020-01-28 20:58 hyx1 阅读(110) 评论(0) 推荐(0)
摘要:Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted i 阅读全文
posted @ 2020-01-28 16:30 hyx1 阅读(123) 评论(0) 推荐(0)
摘要:Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements that appear twi 阅读全文
posted @ 2020-01-24 11:05 hyx1 阅读(123) 评论(0) 推荐(0)
摘要: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 sh 阅读全文
posted @ 2020-01-23 22:04 hyx1 阅读(153) 评论(0) 推荐(0)
摘要:Given a string, find the length of the longest substring without repeating characters. Example 1: Input: "abcabcbb" Output: 3 Explanation: The answer 阅读全文
posted @ 2020-01-17 14:56 hyx1 阅读(116) 评论(0) 推荐(0)