File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -193,7 +193,7 @@ func min(a,b int) int{
193193 }
194194 return a
195195}
196- ```
196+ ```
197197
198198### Javascript
199199``` Javascript
@@ -214,7 +214,31 @@ var findMinArrowShots = function(points) {
214214};
215215```
216216
217+ ### TypeScript
218+
219+ ``` typescript
220+ function findMinArrowShots(points : number [][]): number {
221+ const length: number = points .length ;
222+ if (length === 0 ) return 0 ;
223+ points .sort ((a , b ) => a [0 ] - b [0 ]);
224+ let resCount: number = 1 ;
225+ let right: number = points [0 ][1 ]; // 右边界
226+ let tempPoint: number [];
227+ for (let i = 1 ; i < length ; i ++ ) {
228+ tempPoint = points [i ];
229+ if (tempPoint [0 ] > right ) {
230+ resCount ++ ;
231+ right = tempPoint [1 ];
232+ } else {
233+ right = Math .min (right , tempPoint [1 ]);
234+ }
235+ }
236+ return resCount ;
237+ };
238+ ```
239+
217240### C
241+
218242``` c
219243int cmp (const void * a,const void * b)
220244{
You can’t perform that action at this time.
0 commit comments