LeedCode 刷题
1. func twoSun(_ nums: [Int], _ target: Int) ->[Int]
2. func ambiguousCoordinates(_ S: String) -> [String]
3. func arrangeCoins(_ n: Int) -> Int
4. func removeDuplicates(_ nums: inout [Int]) -> Int
5. func removeElement(_ nums: inout [Int], _ val: Int) -> Int
6. func searchInsert(_ nums: [Int], _ target: Int) -> Int
7. func maxSubArray(_ nums: [Int]) -> Int
8. func plusOne(_ digits: [Int]) -> [Int]
9. func merge(_ nums1: inout [Int], _ m: Int, _ nums2: [Int], _ n: Int)
10. func generate(_ numRows: Int) -> [[Int]]
11. func getRow(_ rowIndex: Int) -> [Int]
12. func maxProfit(_ prices: [Int]) -> Int
13. func maxProfit2(_ prices: [Int]) -> Int //未完成
14. func thirdMax(_ nums: [Int]) -> Int
15. func findDisappearedNumbers(_ nums: [Int]) -> [Int]
16. func maximumProduct(_ nums: [Int]) -> Int
17. func findMaxConsecutiveOnes(_ nums: [Int]) -> Int
18. func findMaxAverage(_ nums: [Int], _ k: Int) -> Double
19. func reverse(_ x: Int) -> Int
20. func arrayPairSum(_ nums: [Int]) -> Int
21. func groupAnagrams(_ strs: [String]) -> [[String]]
22. func singleNumber(_ nums: [Int]) -> Int
23. func twoSum(_ numbers: [Int], _ target: Int) -> [Int]
24.func majorityElement(_ nums: [Int]) -> Int
25. func containsDuplicate(_ nums: [Int]) -> Bool
26.func containsNearbyDuplicate(_ nums: [Int], _ k: Int) -> Bool
27.func missingNumber(_ nums: [Int]) -> Int
28.func moveZeroes(_ nums: inout [Int])
29. func arrayPairSum(_ nums: [Int]) -> Int
1. func isPalindrome(_ x: Int) -> Bool
2. func romanToInt(_ s: String) -> Int
3.isValid(_ s: String) -> Bool
3.func strStr(_ haystack: String, _ needle: String) -> Int
4.func lengthOfLongestSubstring(_ s: String) -> Int//未完成
5. func longestPalindrome(_ s: String) -> String
6. func maxArea(_ height: [Int]) -> Int
7. func intToRoman(_ num: Int) -> String
8. func countAndSay(_ n: Int) -> String
9. func multiply(_ num1: String, _ num2: String) -> String
10. func isPalindrome(_ s: String) -> Bool
11.public int titleToNumber(String s)
12.func addDigits(_ num: Int) -> Int
//在自己编译器运行没有问题 ,但是在线编译器编译不通过
1. func removeNthFromEnd(_ head: ListNode?, _ n: Int) -> ListNode?
2. func mergeTwoLists(_ l1: ListNode?, _ l2: ListNode?) -> ListNode?
3. func swapPairs(_ head: ListNode?) -> ListNode?
4. func hasCycle(_ head: ListNode?) ->Bool
5. func isSameTree(_ p: TreeNode?, _ q: TreeNode?) -> Bool
6. func isSymmetric(_ root: TreeNode?) -> Bool
7. func maxDepth(_ root: TreeNode?) -> Int
8 func levelOrderBottom(_ root: TreeNode?) -> [[Int]]
// 不支持Swift
9. public ListNode getIntersectionNode(ListNode headA, ListNode headB)
10.func removeElements(_ head: ListNode?, _ val: Int) -> ListNode?
1. func generateParenthesis(_ n: Int) -> [String]
2. func combinationSum(_ candidates: [Int], _ target: Int) -> [[Int]]
3. func combinationSum2(_ candidates: [Int], _ target: Int) -> [[Int]]
4. func permute(_ nums: [Int]) -> [[Int]]
5. func climbStairs(_ n: Int) -> Int // DFS超时
5. func climbStairs1(_ n: Int) -> Int //递归超时
5. func climbStairs2(_ n: Int) -> Int
1. func mySqrt(_ x: Int) -> Int
1.Select Email From Person Group By Email Having Count(*) > 1