โ† IBM questions

Check Pangram and Longest Palindromic Substring

Filed under IBM

Free read 1 of 3

Confirm if spaces and punctuation should be ignored for the pangram check and if uppercase/lowercase letters are treated as equivalent.

The question

Given a string, check whether it is a pangram (contains every letter of the English alphabet at least once) and find the longest palindromic substring within it.

Constraints

  • String length n is between 1 and 1000.
  • String may contain uppercase and lowercase letters, spaces, and punctuation.

Examples

Input
s = "babad"
Output
Pangram: False, Longest Palindrome: "bab" (or "aba")
Why
Does not contain all letters. Longest palindrome is length 3.

Approach

  1. Confirm if spaces and punctuation should be ignored for the pangram check and if uppercase/lowercase letters are treated as equivalent.

Tips

  • What they are testing: Test with full alphabet sentences for pangram, and strings with no repeating characters or all identical characters for palindromes.
  • Common mistake: Case sensitivity when checking pangrams; ensure all characters are converted to lowercase first.

Related IBM questions

Collected from public candidate posts and coding forums. Updated Nov 2026.