Goldman Sachs | 24th October | Online Assessments | Palindrome Counter | Condensed List
GoldmanSachs · Question · Posted Oct 2022
Question 1 <problem>145</problem> Palindrome Counter A palindrome is a string that reads the same from the left and from the right. For example, mom and tacocat are palindromes, as are any single character strings. Given a string, determine the number if substrings that are palindromes. Example The string is s = 'tacocat'. Palindromic substrings are ['t','a','c', 'o','c','a','t','coc','acoca','tacocat'] There are 10 palindromic substrings. Constraints 1 <= |s| <= 5000 each character of s, s[i] belongs to {'a'-'z'}. Function Description Work on ...
The full answer & interview discussion are available to premium members.
Log in Create a free account