classSolution { fun minStickers(stickers: Array<String>, target: String): Int { valn= target.length valm=1 shl n valdp= IntArray(m) { Int.MAX_VALUE } dp[0] = 0 for (i in 0 until m) { if (dp[i] == Int.MAX_VALUE) continue for(sticker in stickers) { varcur= i for(c in sticker) { for (j in target.indices) { if (target[j] == c && cur shr j and 1 == 0) { cur = cur or(1 shl j) break } } } dp[cur] = min(dp[cur], dp[i] + 1) } } returnif (dp[m - 1] == Int.MAX_VALUE) -1else dp[m - 1] } }