Check near-palindrome with one deletion
Company: Bloomberg
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Technical Screen
Given a string s, determine if it can become a palindrome after deleting at most one character. Return true or false and provide time and space complexity. Follow up: output one valid index to delete if possible.
Quick Answer: This question evaluates string manipulation and algorithmic problem-solving skills, focusing on palindromic properties and robust handling of edge cases within the Coding & Algorithms domain.
Return whether s can be a palindrome after deleting at most one character.
Constraints
- Inputs are provided as Python literals matching the function signature.
- Return a deterministic exact-match result.
Examples
Input: ('aba',)
Expected Output: True
Explanation: Already palindrome.
Input: ('abca',)
Expected Output: True
Explanation: Delete b or c.
Hints
- Choose a representation that makes the core operation simple.
- Handle empty and boundary inputs before the main algorithm.