Goldman Sachs OA Question 2024 June | HashMap & Strings | on-campus
Goldman-Sachs · Question · Posted Jun 2026
Question: Longest Palindrome Problem Statement Given a string s which consists of lowercase or uppercase letters, return the length of the longest palindrome that can be built with those letters. Letters are case sensitive, for example, "Aa" is not considered a palindrome. Constraints 1 <= s.length <= 2000 s consists of lowercase and/or uppercase English letters only. Examples Example 1: Input: s = "abccccdd" Output: 7 Explanation 1: One longest palindrome that can be built is "dccaccd", whose length is ...
The full answer & interview discussion are available to premium members.
Log in Create a free account