Skip to content

Commit 0157dad

Browse files
committed
Runtime: 1 ms (Top 81.69%) | Memory: 42.2 MB (Top 11.27%)
1 parent 100559e commit 0157dad

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scripts/algorithms/C/Construct the Lexicographically Largest Valid Sequence/Construct the Lexicographically Largest Valid Sequence.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Runtime: 1 ms (Top 81.69%) | Memory: 42.2 MB (Top 11.27%)
12
class Solution {
23

34
public int[] constructDistancedSequence(int n) {
@@ -13,7 +14,7 @@ private boolean calc(int index, int[] ans, boolean[] visited, int n) {
1314
}
1415
if (ans[index] != 0) return calc(index + 1, ans, visited, n); // value already assigned in this position. So go ahead with the next index.
1516
else {
16-
// we start from n to 1 since we need to find out the lexicographically largest sequence.
17+
// we start from n to 1 since we need to find out the lexicographically largest sequence.
1718
for (int i = n; i >= 1; i--) {
1819
if (visited[i]) continue;
1920
visited[i] = true;
@@ -33,4 +34,3 @@ private boolean calc(int index, int[] ans, boolean[] visited, int n) {
3334
return false;
3435
}
3536
}
36-

0 commit comments

Comments
 (0)