
LeetCode每日一题
文章平均质量分 51
我说我是程序猿
要么做,要么做梦~
展开
-
23. Merge k Sorted Lists
题目描述: Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. Example: Input: [ 1->4->5, 1->3->4, 2->6 ] Output: 1->1->2->3...原创 2018-08-18 11:07:51 · 302 阅读 · 0 评论 -
*32. Longest Valid Parentheses
题目描述: Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring. Example 1: Input: "(()" Output: 2 Explanation: The longes...原创 2018-08-21 15:19:42 · 170 阅读 · 0 评论 -
*22. Generate Parentheses
题目描述: 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: [ "((()))", "(()())", "(())()", "...原创 2018-08-24 10:04:36 · 154 阅读 · 0 评论 -
31. 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 pos...原创 2018-08-20 14:57:34 · 277 阅读 · 0 评论 -
34. Find First and Last Position of Element in Sorted Array
题目描述: Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value. Your algorithm's runtime complexity must be in the order of O(log n). ...原创 2018-08-23 09:55:32 · 180 阅读 · 0 评论 -
28. Implement strStr()
题目分析: Implement strStr(). Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. Example 1: Input: haystack = "hello", needle = "ll" Output: 2 ...原创 2018-08-19 14:45:10 · 142 阅读 · 0 评论 -
25. Reverse Nodes in k-Group
题目描述: Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. k is a positive integer and is less than or equal to the length of the linked list. If the num...原创 2018-08-19 14:26:39 · 171 阅读 · 0 评论 -
33. Search in Rotated Sorted Array
题目描述: Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]). You are given a target value to search. If...原创 2018-08-22 11:22:23 · 145 阅读 · 0 评论 -
24.Swap Nodes in Pairs
题目描述: Given a linked list, swap every two adjacent nodes and return its head. Example: Given 1->2->3->4, you should return the list as 2->1->4->3. Note: Your algorithm should u...原创 2018-08-16 15:38:39 · 324 阅读 · 0 评论 -
27. Remove Element
题目描述: Given an array nums and a value val, remove all instances of that value in-place and return the new length. Do not allocate extra space for another array, you must do this by modifying the inp...原创 2018-08-18 15:52:43 · 148 阅读 · 0 评论 -
*36. Valid Sudoku
题目描述: Determine if a 9x9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules: Each row must contain the digits 1-9 without repetition. Each column mus...原创 2018-08-25 11:28:09 · 154 阅读 · 0 评论