FastPrepHigh-Severity Counts by Search Type

High-Severity Counts by Search Type

Chainalysis logoChainalysis● EasyFULLTIMEONSITE INTERVIEW
Learn

Problem statement

Parallel arrays describe stream logs: searchTypes[i] is the search type and severities[i] is the severity.

For every distinct search type, count logs whose severity is exactly high. Return strings formatted as searchType=count, sorted lexicographically by search type. Include a distinct type even when its count is zero.

Function

highSeverityCountsBySearchType(searchTypes: String[], severities: String[]) → String[]

Examples

Example 1

searchTypes = ["transfer","address","transfer"]severities = ["high","low","high"]return = ["address=0","transfer=2"]

Both types appear, and only exact high severities count.

Example 2

searchTypes = ["tx","tx"]severities = ["HIGH","low"]return = ["tx=0"]

Severity matching is exact and case-sensitive.

Constraints

  • The arrays have the same length from 0 through 100000.
  • Every search type and severity is a non-empty ASCII string.
  • Search types do not contain =.

More Chainalysis problems

See Chainalysis hiring insights
public String[] highSeverityCountsBySearchType(String[] searchTypes, String[] severities) {
    // write your code here
}
searchTypes["transfer","address","transfer"]
severities["high","low","high"]
expected["address=0", "transfer=2"]
Checking account…