File tree Expand file tree Collapse file tree 1 file changed +87
-0
lines changed
Expand file tree Collapse file tree 1 file changed +87
-0
lines changed Original file line number Diff line number Diff line change 2525* MEDIUM 1642 Furthest Building You Can Reach https://leetcode.com/problems/furthest-building-you-can-reach
2626* HARD 295 Find Median from Data Stream https://leetcode.com/problems/find-median-from-data-stream
2727* MEDIUM 1631 Path With Minimum Effort https://leetcode.com/problems/path-with-minimum-effort/
28+
29+ ---
30+
31+ 業配我的 Github 跟解法: [ louis222220 - No. 973 in TypeScript] ( https://github.com/louis222220/leetcode-practice/commit/fcf507e23cb954cc7e78444239fd98305af149b5 )
32+
33+ - 嘗試優化:提前把所有點的距離算出來,再做排序,減少排序期間做了多餘的距離計算
34+ ![ ] ( https://i.imgur.com/5FKMaxz.png )
35+
36+ Louis 提議下次 1642 if end early we can do 295 (hard) Problem brief
37+
38+
39+ ---
40+
41+ 你下午7:56
42+ https://hackmd.io/awH5L8paQ6C0fnSH73ITkQ
43+ https://hackmd.io/awH5L8paQ6C0fnSH73ITkQ
44+ Y.J.Lee下午8:00
45+ hi all
46+ 你下午8:00
47+ https://hackmd.io/awH5L8paQ6C0fnSH73ITkQ
48+ Y.J.Lee下午8:02
49+ 我猜這題是因為老外不一定會算平面2d點到點的距離XD
50+ 郁勳下午8:04
51+ 我先看XD
52+ Y.J.Lee下午8:05
53+ 離題回一下Louis #378 我能想到最好的解大概就用兩次binary search
54+ #973 這題要跳過我沒差XD
55+ 李政哲下午8:08
56+ 讓人家想想 QQ
57+ Y.J.Lee下午8:19
58+ 前幾個小 or 前幾個大
59+ Y.J.Lee下午8:23
60+ 嚴格講這樣應該不算啦 因為有可能題目不讓你改
61+ Y.J.Lee下午8:25
62+ msc的作法 直接做comparator 就好了space O(1)
63+ 嗯 Java也是一樣的
64+ Y.J.Lee下午8:26
65+ nice to know golang feature
66+ Y.J.Lee下午8:28
67+ 嗯
68+ Golang 這樣設計更乾淨
69+ Y.J.Lee下午8:32
70+ 我聽起來也以為是cache機制XD
71+ Y.J.Lee下午8:33
72+ python function 常常會加@cache 只要input parameter 一樣就不會重算
73+ 其實就是另外拿一個dict 存 input output
74+ dp top-down 常用
75+ Y.J.Lee下午8:34
76+ nice point
77+ Y.J.Lee下午8:36
78+ 對啊 魔改comparator lol
79+ X秒後 之類的
80+ Y.J.Lee下午8:38
81+ 其實也是一樣改comparator 因為也是向量
82+ 只是你現在加一個 X* dx + X* dy
83+ X 秒數 dx dy 是速度的向量
84+ 題目還要加 秒數 跟 每個點的速度向量
85+ Y.J.Lee下午8:40
86+ X秒內最接近原點的距離
87+ 改這樣真的滿複雜的XD
88+ Y.J.Lee下午8:45
89+ search 距離
90+ Y.J.Lee下午8:53
91+ 這個做法就像作者說的 是quicksort的變形
92+ Y.J.Lee下午8:54
93+ 三層while的做法是quicksort的其中一種partition
94+ https://en.wikipedia.org/wiki/Quicksort#Hoare_partition_scheme
95+ 另一種常見的partition就是都拿最後一個當pivot
96+ https://en.wikipedia.org/wiki/Quicksort#Lomuto_partition_scheme
97+ Y.J.Lee下午8:56
98+ 跟quicksort只差在他拿pivot partition的時候
99+ 試到K個就可以了
100+ Y.J.Lee下午8:58
101+ quick select 不熟QQ
102+ 不過我猜應該差不多啦
103+ partition GIF
104+ https://en.wikipedia.org/wiki/File:Quicksort-example.gif
105+ Y.J.Lee下午9:00
106+ 用滑鼠畫一畫也有快8萬點閱 震驚了
107+ Y.J.Lee下午9:01
108+ XD
109+ 那個不知道怎麼畫的
110+ 說是在ipad上用手我也相信
111+ Y.J.Lee下午9:09
112+ 上看10萬點閱
113+ Y.J.Lee下午9:10
114+ 隨意
You can’t perform that action at this time.
0 commit comments