[LeetCode]23. Merge k Sorted Lists

2019-06-07
阅读 2 分钟
931
Merge k sorted linked lists and return it as one sorted list. Analyzeand describe its complexity.Example: Input: [ 1->4->5, 1->3->4, 2->6 ] Output: 1->1->2->3->4->4->5->6要减小算法的复杂度,就要利用已知的条件,已知的条件就是已有的顺序。

[LeetCode]22. Generate Parentheses

2019-06-06
阅读 2 分钟
869
Given n pairs of parentheses, write a function to generate allcombinations of well-formed parentheses.For example, given n = 3, a solution set is: [ "((()))", "(()())", "(())()", "()(())", "()()()" ]我们可以在每个index上确定上面状态带来的每个状态能引进的所有状态,可以看成是广度遍历。

[LeetCode]21. Merge Two Sorted Lists

2019-06-05
阅读 1 分钟
1k
Merge two sorted linked lists and return it as a new list. The newlist should be made by splicing together the nodes of the first twolists.Example: Input: 1->2->4, 1->3->4 Output: 1->1->2->3->4->4

[LeetCode]20. Valid Parentheses

2019-06-04
阅读 1 分钟
1.3k
Given a string containing just the characters '(', ')', '{', '}', '['and ']', determine if the input string is valid.An input string is valid if: Open brackets must be closed by the same type of brackets. Openbrackets must be closed in the correct order. Note that an emptystring is also considere...

[LeetCode]19. Remove Nth Node From End of List

2019-06-04
阅读 1 分钟
961
Given a linked list, remove the n-th node from the end of list andreturn its head.Example: Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the linked list becomes1->2->3->5. Note: Given n will always be valid. Follow up: Could you do ...

[LeetCode]18.4 Sum

2019-06-04
阅读 3 分钟
1k
Given an array nums of n integers and an integer target, are thereelements a, b, c, and d in nums such that a + b + c + d = target? Findall unique quadruplets in the array which gives the sum of target.Note: The solution set must not contain duplicate quadruplets. Example: Given array nums = [1, ...

[LeetCode]17. Letter Combinations of a Phone Number

2019-05-28
阅读 3 分钟
1.3k
Given a string containing digits from 2-9 inclusive, return allpossible letter combinations that the number could represent. A mapping of digit to letters (just like on the telephone buttons) isgiven below. Note that 1 does not map to any letters. Example: Input: "23" Output: ["ad", "ae", "af", "...

[Leetcode]16. 3Sum Closest

2019-05-21
阅读 2 分钟
1k
Given an array nums of n integers and an integer target, find threeintegers in nums such that the sum is closest to target. Return thesum of the three integers. You may assume that each input would haveexactly one solution.Example: Given array nums = [-1, 2, 1, -4], and target = 1. The sum that i...

[LeetCode]15. 3Sum

2019-05-20
阅读 3 分钟
1.1k
Given an array nums of n integers, are there elements a, b, c in numssuch that a + b + c = 0? Find all unique triplets in the array whichgives the sum of zero.Note: The solution set must not contain duplicate triplets. Example: Given array nums = [-1, 0, 1, 2, -1, -4], A solution set is: [ [-1, 0...

[LeetCode]13. Longest Common Prefix

2019-05-18
阅读 1 分钟
933
Write a function to find the longest common prefix string amongst anarray of strings.If there is no common prefix, return an empty string "". Example 1: Input: ["flower","flow","flight"] Output: "fl" Example 2: Input: ["dog","racecar","car"] Output: "" Explanation: There is nocommon prefix among ...

VasSonic Android源码解析

2017-09-11
阅读 5 分钟
7.6k
VasSonic是腾讯推出的为了提高H5页面首屏加载速度而推出的高性能Hybrid框架,目前广泛应用在QQ商城等Hybrid界面中,以提高用户体验。