K-Palindrome Problem Statement

Determine whether a given string str can be considered a K-Palindrome.

A string is considered a K-Palindrome if it can be transformed into a palindrome after removing up to ‘k’ characters.

Example:

Input:
str = "ababba", k = 3
Output:
True
Explanation:

If we remove one ‘b’ from the 3rd position, the string becomes "ababa", which is a palindrome. Thus, the output is True.

Constraints:

  • 1 <= T <= 10
  • 1 <= |str| <= 1000
  • 1 <= k <= 30
  • Time limit: 1 sec
AnswerBot
2d

The problem is to determine whether a given string can be considered a K-Palindrome by removing up to 'k' characters.

  • Iterate through the string from both ends and check if characters match, if not inc...read more

Help your peers!
Add answer anonymously...
Uber Software Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter