We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5e36c32 commit c68c110Copy full SHA for c68c110
my-submissions/e942 v1.py
@@ -0,0 +1,10 @@
1
+class Solution:
2
+ def diStringMatch(self, s: str) -> List[int]:
3
+ minn, maxx = 0, 0
4
+ output = [0]
5
+ for c in s :
6
+ if c == 'I' :
7
+ output.append(maxx := maxx + 1)
8
+ else :
9
+ output.append(minn := minn - 1)
10
+ return [x - minn for x in output]
my-submissions/e942 v2.py
@@ -0,0 +1,5 @@
+ output = [0] + [(maxx := maxx + 1) if c == 'I' else (minn := minn - 1) for c in s]
0 commit comments