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 af5a95a commit 2ed2d8bCopy full SHA for 2ed2d8b
problems/0763.划分字母区间.md
@@ -128,7 +128,26 @@ class Solution:
128
129
Go:
130
131
-
+Javascript:
132
+```Javascript
133
+var partitionLabels = function(s) {
134
+ let hash = {}
135
+ for(let i = 0; i < s.length; i++) {
136
+ hash[s[i]] = i
137
+ }
138
+ let result = []
139
+ let left = 0
140
+ let right = 0
141
142
+ right = Math.max(right, hash[s[i]])
143
+ if(right === i) {
144
+ result.push(right - left + 1)
145
+ left = i + 1
146
147
148
+ return result
149
+};
150
+```
151
152
153
-----------------------
0 commit comments