Spotify Interview Question

Group an arrays consecutive characters, while keeping an eye for speed and memory performance.