Back to Browse

Leetcode 1332. Remove Palindromic Subsequences

2.8K views
Mar 8, 2021
6:16

Given a string s consisting only of letters 'a' and 'b'. In a single step you can remove one palindromic subsequence from s. Return the minimum number of steps to make the given string empty. A string is a subsequence of a given string, if it is generated by deleting some characters of a given string without changing its order. A string is called palindrome if is one that reads the same backward as well as forward. Example 1: Input: s = "ababa" Output: 1 Explanation: String is already palindrome Example 2: Input: s = "abb" Output: 2 Remove palindromic subsequence "a" then "bb". Link to challenge: https://leetcode.com/problems/remove-palindromic-subsequences/ or https://leetcode.com/explore/challenge/card/march-leetcoding-challenge-2021/589/week-2-march-8th-march-14th/3665/

Download

0 formats

No download links available.

Leetcode 1332. Remove Palindromic Subsequences | NatokHD