You are given a string playlist representing the order in which songs were played. Each non-space character represents a song; spaces are ignored when computing modes (they may appear as visual separators in the input).
A music player has two modes:
K.K characters is a permutation of the full song set (each distinct song appears exactly once).Return a list [isRandom, isShuffle] of two booleans.
Example 1:
Input: "ABACBA" Distinct songs: {A, B, C} (K = 3). After space removal: "ABACBA" (length 6). 6 % 3 == 0, so chunks of 3: "ABA" (missing C), "CBA" (full). Not all chunks are permutations, so shuffle = false. Output: [true, false]
Example 2:
Input: "ABCD CABD BCDA" Distinct songs: {A, B, C, D} (K = 4). After removing spaces: "ABCDCABDBCDA" (length 12). Chunks of 4: "ABCD", "CABD", "BCDA" — all permutations of {A,B,C,D}. Output: [true, true]
Constraints: