FastPrepFilter Team A Logs

Filter Team A Logs

Chainalysis logoChainalysis● EasyFULLTIMEONSITE INTERVIEW
Learn

Problem statement

Each index represents one log in a data stream, and teams[i] is that log's team.

Return the zero-based indices of every log whose team is exactly Team A, preserving stream order.

Function

filterTeamALogs(teams: String[]) → int[]

Examples

Example 1

teams = ["Team A","Team B","Team A"]return = [0,2]

The first and third logs belong to Team A.

Example 2

teams = ["team a","Team B"]return = []

Team matching is exact and case-sensitive.

Constraints

  • 0 <= teams.length <= 100000.
  • Each team name is a non-empty ASCII string.

More Chainalysis problems

See Chainalysis hiring insights
public int[] filterTeamALogs(String[] teams) {
    // write your code here
}
teams["Team A","Team B","Team A"]
expected[0,2]
Checking account…