The Number of Senior Citizens problem gives you a list of passenger details as strings in a fixed format. Extract each passenger's age from the string and count how many passengers are strictly older than 60 years. This easy coding problem tests string indexing and character-to-integer conversion.
Meta, Google, and Bloomberg ask this easy problem to quickly verify string parsing skills — specifically, extracting a substring from a fixed-format string and comparing it numerically. The array and string interview pattern is demonstrated at a fundamental level.
Fixed-position substring extraction. Each passenger string has the age at a known position (e.g., indices 11-12 in a fixed-format string). Extract int(details[11:13]) for each passenger and count those > 60.
details = ["7868190130M7522","5303914400F9211"].
>= 60 instead of > 60 (problem says strictly older than 60).Fixed-format string parsing problems require reading the specification exactly. Always draw out the character positions before coding: "position 0-1 = phone type, 2-10 = phone number, 11-12 = age..." etc. Extract the relevant substring and convert to the appropriate type. Easy problems like this are accuracy tests — wrong indexing or wrong comparison operator means a wrong answer despite correct logic. Slow down and verify the format specification.