File tree 1 file changed +31
-0
lines changed
1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+ < head >
4
+ < meta charset ="UTF-8 ">
5
+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
6
+ < meta http-equiv ="X-UA-Compatible " content ="ie=edge ">
7
+ < title > Document</ title >
8
+ </ head >
9
+ < body >
10
+ < script >
11
+ // Source : https://leetcode.com/problems/contains-duplicate-iii/
12
+ // Author : 悬笔e绝
13
+ // Date : 2019-12-12
14
+
15
+ /**
16
+ * @param {number[] } nums
17
+ * @param {number } k
18
+ * @param {number } t
19
+ * @return {boolean }
20
+ */
21
+ var containsNearbyAlmostDuplicate = function ( nums , k , t ) {
22
+ var len = nums . length ;
23
+ for ( var i = 0 ; i < len ; i ++ )
24
+ for ( var j = i + 1 ; j <= Math . min ( i + k , len - 1 ) ; j ++ )
25
+ if ( Math . abs ( nums [ i ] - nums [ j ] ) <= t ) return true ;
26
+ return false ;
27
+ } ;
28
+
29
+ </ script >
30
+ </ body >
31
+ </ html >
You can’t perform that action at this time.
0 commit comments