Implement an algorithm to manipulate arrays or strings efficiently within a strict 40-minute timeframe.