摘要: 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 @ 2018-03-03 16:24 轻风舞动 阅读(624) 评论(0) 推荐(0)
摘要: Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring. Example 1: Exampl 阅读全文
posted @ 2018-03-03 16:07 轻风舞动 阅读(512) 评论(0) 推荐(0)
摘要: Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: No 阅读全文
posted @ 2018-03-03 15:54 轻风舞动 阅读(750) 评论(0) 推荐(0)
摘要: Given four lists A, B, C, D of integer values, compute how many tuples (i, j, k, l) there are such that A[i] + B[j] + C[k] + D[l] is zero. To make pro 阅读全文
posted @ 2018-03-03 15:22 轻风舞动 阅读(607) 评论(0) 推荐(0)
摘要: Given an array nums of n integers and an integer target, are there elements a, b, c, and d in nums such that a + b + c + d = target? Find all unique q 阅读全文
posted @ 2018-03-03 14:04 轻风舞动 阅读(494) 评论(0) 推荐(0)
摘要: Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. For example, giv 阅读全文
posted @ 2018-03-03 09:36 轻风舞动 阅读(861) 评论(0) 推荐(0)
摘要: Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telepho 阅读全文
posted @ 2018-03-03 08:24 轻风舞动 阅读(531) 评论(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 endpo 阅读全文
posted @ 2018-03-03 07:32 轻风舞动 阅读(815) 评论(0) 推荐(0)
摘要: Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. 阅读全文
posted @ 2018-03-03 07:20 轻风舞动 阅读(812) 评论(0) 推荐(0)
摘要: Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string "". Exampl 阅读全文
posted @ 2018-03-03 06:59 轻风舞动 阅读(1933) 评论(0) 推荐(0)
摘要: Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the thr 阅读全文
posted @ 2018-03-03 04:41 轻风舞动 阅读(364) 评论(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 @ 2018-03-03 04:26 轻风舞动 阅读(469) 评论(0) 推荐(0)
摘要: Given an array with n objects colored red, white or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the or 阅读全文
posted @ 2018-03-03 03:10 轻风舞动 阅读(611) 评论(0) 推荐(0)