FastPrepValidate Timestamped Message Records

Validate Timestamped Message Records

Stripe logoStripe● EasyFULLTIMENEW GRADPHONE SCREEN
Learn

Problem statement

Validate records read from a message file. Each line begins with a datetime prefix followed by exactly five record fields.

For this practice adapter, fields are separated by tab characters. The first field is the datetime prefix and is removed before validating the record. A line is valid when exactly five record fields remain and every one is non-empty after trimming; the first record field is the name.

Return one boolean per input line in the same order.

Function

validateMessageRecords(lines: String[]) → boolean[]

Examples

Example 1

lines = ["2026-01-17T10:00:00Z\talice\tmessage\tfile-1\tready\thello","2026-01-17T10:01:00Z\t\tmessage\tfile-2\tready\thi","2026-01-17T10:02:00Z\tbob\tmessage\tfile-3\tready"]return = [true,false,false]

The first line has five non-empty record fields. The second has an empty name, and the third has only four record fields.

Example 2

lines = ["ignored\tann\ttype\tpath\tok\tnote","ignored\tann\ttype\tpath\t   \tnote"]return = [true,false]

The datetime text is ignored. A whitespace-only record field is empty.

Constraints

  • 1 <= lines.length <= 10000.
  • Each line has at most 10000 characters.
  • The datetime prefix itself is opaque and is not validated.
  • Only the five record fields must be non-empty after trimming spaces.
  • Tabs are the only field separators.

More Stripe problems

See Stripe hiring insights
public boolean[] validateMessageRecords(String[] lines) {
  // write your code here
}
lines["2026-01-17T10:00:00Z\talice\tmessage\tfile-1\tready\thello","2026-01-17T10:01:00Z\t\tmessage\tfile-2\tready\thi","2026-01-17T10:02:00Z\tbob\tmessage\tfile-3\tready"]
expected[true,false,false]
Checking account…