Skip to content

Commit 7d82c4e

Browse files
committed
Create 1299-replace-elements-with-great ... .dart
1 parent ff32745 commit 7d82c4e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Solution {
2+
List<int> replaceElements(List<int> arr) {
3+
var curMax = -1;
4+
for (int i = arr.length - 1; i > -1; i--) {
5+
int newMax = max(curMax, arr[i]);
6+
arr[i] = curMax;
7+
curMax = newMax;
8+
}
9+
return arr;
10+
}
11+
}

0 commit comments

Comments
 (0)