Solve a classic array manipulation or string parsing problem on the board, focusing on optimal time and space complexity.