Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Use a stack to store the characters, when there are k same characters, delete them.
To make it more efficient, use a pair to store the value and the count of each character.