Solve a classic array-based or string-manipulation coding challenge, detailing your approach to handling edge cases.