Skip to content

Commit 57010ef

Browse files
committed
Runtime: 267 ms (Top 20.55%) | Memory: 67.5 MB (Top 7.22%)
1 parent c4eb8b7 commit 57010ef

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

scripts/algorithms/G/Gray Code/Gray Code.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Runtime: 267 ms (Top 20.55%) | Memory: 67.5 MB (Top 7.22%)
12
/**
23
* @param {number} n
34
* @return {number[]}
@@ -8,9 +9,9 @@ var grayCode = function(n) {
89

910
const dfs = (n, arr) => {
1011
if (n === 1) return arr
11-
12+
1213
const revArr = [...arr].reverse()
13-
14+
1415
addOneBefore('0', arr)
1516
addOneBefore('1', revArr)
1617

@@ -28,4 +29,4 @@ const binaryToInt = (arr) => {
2829
arr[i] = parseInt(arr[i], 2)
2930
}
3031
return arr
31-
}
32+
}

0 commit comments

Comments
 (0)