Palindrome String Check
Updated
Problem statement
Given a string s of lowercase English letters, return true if s is a palindrome and false otherwise.
A palindrome reads the same from left to right as from right to left: its first and last characters are equal, its second and second-to-last characters are equal, and so on.
Function
isPalindrome(s: String) → booleanExamples
Example 1
s = "rotator"return = trueReading rotator from right to left gives rotator again. The middle a has no partner and needs none.
Example 2
s = "decked"return = falseThe outer pairs d and d, then e and e, match, but the innermost pair c and k does not.
Example 3
s = "z"return = trueA single character reads the same both ways.
Constraints
1 <= s.length <= 5 * 10^4sconsists of lowercase English letters.
More Bank of America Onsite Interview questions
- Centered Star PyramidONSITE INTERVIEW · Seen Nov 2025
- Employees Without a ManagerONSITE INTERVIEW · Seen Nov 2025
- Longest Substring Without Repeating CharactersONSITE INTERVIEW · Seen Nov 2025
- N-th Fibonacci NumberONSITE INTERVIEW · Seen Nov 2025
- Reverse Each Word in a SentenceONSITE INTERVIEW · Seen Nov 2025
- Second Highest SalaryONSITE INTERVIEW · Seen Nov 2025
- Three Numbers That Add Up to a TargetONSITE INTERVIEW · Seen Apr 2025
- Duplicate RowsONSITE INTERVIEW · Seen Oct 2023
- Factorial of a NumberONSITE INTERVIEW · Seen Oct 2023
- Second Largest Element in an ArrayONSITE INTERVIEW · Seen Jun 2023
Similar questions at other companies
- Longest Spoken PrefixElevenLabs · ONSITE INTERVIEWElevenLabs interview questions
- Palindrome Check Ignoring SymbolsWalmart · ONSITE INTERVIEWWalmart interview questions
- Reverse a String Keeping Dashes in PlaceNykaa · ONSITE INTERVIEWNykaa interview questions
- Reverse Vowels of a StringGoogle · ONSITE INTERVIEWGoogle interview questions
- Valid Palindrome After NormalizationKotak Mahindra Bank · ONSITE INTERVIEWKotak Mahindra Bank interview questions
- Count Binary SubstringsDocuSign · ONSITE INTERVIEWDocuSign interview questions
- Minimum Changes for Palindromic BlocksCitadel · OA · PHONE SCREEN · ONSITE INTERVIEWCitadel interview questions
- Palindrome Match PercentageApple · ONSITE INTERVIEWApple interview questions
- Reverse A StringNVIDIA · ONSITE INTERVIEWNVIDIA interview questions
- Validate a Word AbbreviationSalesforce · ONSITE INTERVIEWSalesforce interview questions