Quick Overview

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.

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.

Overview: 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

  1. Choose a representation that makes the core operation simple.
  2. Handle empty and boundary inputs before the main algorithm.

Valid Near-Palindrome with One Deletion

mediumBloombergSoftware Engineer

Return whether s can be a palindrome after deleting at most one character.

Examples

Example 1
Input
('aba',)
Output
True
Notes
Already palindrome.
Example 2
Input
('abca',)
Output
True
Notes
Delete b or c.

Constraints

  • •Inputs are provided as Python literals matching the function signature.
  • •Return a deterministic exact-match result.

Comments (0)

No comments yet. Be the first to comment!

Submit your answer

Approved first answer today earns 30 XP
Bold⌘BItalic⌘IInline code⌘`Bullet listTab to nest (○ ■)Numbered listTab to nest (a. i.)QuoteCode block
Formatting help
Sample call
solution('aba')
Language
Case 1
Input
('aba',)
Expected
True
Case 2
Input
('abca',)
Expected
True

Browse More Questions