‘K’ Closest Points to the Origin (easy) Connect Ropes (easy) Top ‘K’ Frequent Numbers (medium) Frequency Sort (medium) Kth Largest Number in a Stream (medium) ‘K’ Closest Numbers (medium) Maximum Distinct Elements (medium) Sum of Elements (medium) Rearrange String (hard) 13. Patter...
‘K’ Closest Points to the Origin (easy) Connect Ropes (easy) Top ‘K’ Frequent Numbers (medium) Frequency Sort (medium) Kth Largest Number in a Stream (medium) ‘K’ Closest Numbers (medium) Maximum Distinct Elements (medium) Sum of Elements (medium) Rearrange String (hard) 13. Patter...
vector<vector<int>>kClosest(vector<vector<int>>& points,intK) { vector<vector<int>> res; priority_queue<pair<int,int>> pq;for(inti =0; i < points.size(); ++i) {intt = points[i][0] * points[i][0] + points[i][1] * points[i][1]; pq.push({t, i});if(pq.size() >...
977 Squares of a Sorted Array 72.40% Easy 976 Largest Perimeter Triangle 58.50% Easy 975 Odd Even Jump 41.70% Hard 974 Subarray Sums Divisible by K 50.30% Medium 973 K Closest Points to Origin 64.40% Medium 972 Equal Rational Numbers 41.80% Hard 971 Flip Binary Tree To Match Preorder Trave...
//时间复杂度:O(n^2) //空间复杂度:O(n) class Solution { public: int numberOfBoomerangs(vector<pair<int, int>>& points) { int res = 0; for( int i = 0 ; i < points.size() ; i ++ ){ // record中存储 点i 到所有其他点的距离出现的频次 unordered_map<int, int> record; for...
2277.Closest-Node-to-Path-in-Tree (H-) 2313.Minimum-Flips-in-Binary-Tree-to-Get-Result (H) 2467.Most-Profitable-Path-in-a-Tree (M+) 2458.Height-of-Binary-Tree-After-Subtree-Removal-Queries (M+) 2646.Minimize-the-Total-Price-of-the-Trips (M+) 2920.Maximum-Points-After-Collecting-...
1595 Minimum Cost to Connect Two Groups of Points 46.3% Hard 1596 The Most Frequently Ordered Products for Each Customer 85.1% Medium 1597 Build Binary Expression Tree From Infix Expression 62.2% Hard 1598 Crawler Log Folder 64.3% Easy 1599 Maximum Profit of Operating a Centennial Wheel 43....
0149 Max Points on a Line 16.9% Hard 0150 Evaluate Reverse Polish Notation Go 36.3% Medium 0151 Reverse Words in a String Go 21.9% Medium 0152 Maximum Product Subarray Go 31.7% Medium 0153 Find Minimum in Rotated Sorted Array Go 45.1% Medium 0154 Find Minimum in Rotated Sorted Arra...
1595 Minimum Cost to Connect Two Groups of Points 42.5% Hard 1596 The Most Frequently Ordered Products for Each Customer 84.1% Medium 1597 Build Binary Expression Tree From Infix Expression 65.9% Hard 1598 Crawler Log Folder 64.3% Easy 1599 Maximum Profit of Operating a Centennial Wheel 43....
作者毕业至今保持着每周一道LeetCode的习惯,不知不觉中已经完成了100+的题目。通过梳理题目,总结解题思路,解题的效率也越来越高,效果还是很明显的。很推荐大家通过做LeetCode题目的方式保持思维的活跃,从枯燥的业务中适当释放一下,既能提高逻辑思维能力,也能提高对算法和数据结构的理解。