Partition Labels
You are given a string s. We want to partition the string into as many parts as possible so that each letter appears in at most one part. Return a list of integers representing the size of these parts.

30:00

Partition Labels
medium
Topics
Companies

You are given a string s. We want to partition the string into as many parts as possible so that each letter appears in at most one part. Return a list of integers representing the size of these parts.

Example 1:
Input: {"s":"ababcbacadefegdehijhklij"}
Output: [9,7,8]
Constraints:
  • 1s.length5001 \leq s.\text{length} \leq 500

  • s consists of lowercase English letters.

Input
arr ={"s":"ababcbacadefegdehijhklij"}

Start. Map last indices.

a

0

b

1

a

2

b

3

c

4

b

5

a

6

c

7

a

8

d

9

e

10

f

11

e

12

g

13

d

14

e

15

h

16

i

17

j

18

h

19

k

20

l

21

i

22

j

23

Partitions:

Variables
No variables to display
DepthFunction Call
Stack empty
0/34