Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c281a35

Browse files
author
konstantin
committed
Medium763 challenge
1 parent aded8e1 commit c281a35

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

‎src/medium/763. Partition Labels .kt‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@ Return a list of integers representing the size of these parts.
1515

1616
class Medium763 : HashTableTopic, TwoPointersTopic, GreedyTopic {
1717

18-
fun partitionLabels(S: String): List<Int> {
18+
fun partitionLabels(s: String): List<Int> {
1919
val last = IntArray(26)
20-
for (i in S.indices) {
21-
last[S[i] - 'a'] = i
20+
for (i in s.indices) {
21+
last[s[i] - 'a'] = i
2222
}
2323
var j = 0
2424
var anchor = 0
25-
val ans = mutableListOf<Int>()
26-
for (i in S.indices) {
27-
j = maxOf(j, last[S[i] - 'a'])
25+
val ans = ArrayList<Int>()
26+
for (i in s.indices) {
27+
j = maxOf(j, last[s[i] - 'a'])
2828
if (i == j) {
2929
ans.add(i - anchor + 1)
3030
anchor = i + 1

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /