摘要:
Given an integer array nums and an integer k, return the kth largest element in the array. Note that it is the kth largest element in the sorted order 阅读全文
阅读排行榜
quickSort use two pointers to decrease Time into O(n * lgn ) or O(n)
2021-06-28 08:45 by Johnson_强生仔仔, 52 阅读, 收藏,
摘要:
Quicksort, 选取pivot, 然后有两个指针, left = 0, right = n - 1, left 不停右移找到nums[left] > pivot, right 不停左移找到nums[right] <= pivot直到left >= right, 停止,那么这时候再recursi 阅读全文
Morris Traversal_ O(1) space to change binary tree to linked list
2021-06-18 19:04 by Johnson_强生仔仔, 51 阅读, 收藏,
摘要:
问题可以参考[LeetCode] 114. Flatten Binary Tree to Linked List_Medium tag: DFS, 这个Morris Traversal能够解决follow up,怎么样用 space O(1) 来去解决这个问题。参考这个题目的solution的app 阅读全文
[LeetCode] 904. Fruit Into Baskets_Medium tag: Two pointers
2021-08-04 10:36 by Johnson_强生仔仔, 50 阅读, 收藏,
摘要:
You are visiting a farm that has a single row of fruit trees arranged from left to right. The trees are represented by an integer array fruits where f 阅读全文
[LeetCode] 37. Sudoku Solver_Hard tag: BackTracking
2021-06-10 06:52 by Johnson_强生仔仔, 48 阅读, 收藏,
摘要:
Write a program to solve a Sudoku puzzle by filling the empty cells. A sudoku solution must satisfy all of the following rules: Each of the digits 1-9 阅读全文
浙公网安备 33010602011771号