Reported March 2025
Chainalysishash table

High-Severity Counts by Search Type

Reported by candidates from Chainalysis's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Chainalysis OA. Under 2s to a working solution.
Founder's read

Chainalysis reported this one in March 2025, and it looks easier than it is. Two parallel arrays, up to 100000 logs each, and you need a count of exactly "high" severity per search type. The hinted pattern says binary search, but the real work is a hash map and a sort. With 100000 entries, a nested loop per type is the trap that blows up. If you're taking this OA in the next day or two, learn the shape now. StealthCoder sits invisibly on your screen as a safety net if you blank mid-assessment.

The problem

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 =.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is one pass. Walk both arrays together, and for each index make sure the search type exists in a hash map, starting at 0. Then add 1 only if severities[i] equals "high" exactly. Case-sensitive, so "HIGH" does nothing, as Example 2 shows. After the pass, collect the keys, sort them lexicographically, and format each as type=count. That's O(n + k log k), which is fine for 100000. The common pitfalls are skipping zero-count types, because you only inserted a key when you saw a high log, and lowercasing the severity, which breaks the spec. Also handle empty arrays by returning an empty list. Don't hunt for a binary search here. If you freeze on the OA, StealthCoder is the hedge that reads the problem and hands you this map-and-sort solution live.

Drill it cold or hedge it with StealthCoder. Either way, don't walk into the OA hoping you remember the trick.

If this hits your live OA

You can drill High-Severity Counts by Search Type cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Made for the candidate who got the OA invite this morning and has 72 hours, not six months.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass Chainalysis's OA.

Chainalysis reuses patterns across OAs. Made for the candidate who got the OA invite this morning and has 72 hours, not six months. Works on HackerRank, CodeSignal, CoderPad, and Karat.

High-Severity Counts by Search Type FAQ

What's the trick in the Chainalysis High-Severity Counts problem?+

Use a hash map from search type to count. Insert every type with 0 on first sight, then increment only when severity is exactly "high". Sort the keys at the end and format each as type=count. One pass, no nested loops.

Is binary search actually needed here?+

Not really. The hint points at binary search, but the natural solution is a hash map plus a sort. You could binary search over a sorted key list, but it adds complexity and no benefit. Counting in a map is simpler and faster.

How do I handle types with zero high-severity logs?+

Add the type to the map with count 0 whenever you see it, regardless of severity. Then only increment on an exact "high" match. Example 1 expects address=0, and that only works if you insert every type up front.

Is severity matching case-sensitive?+

Yes. Example 2 shows "HIGH" does not count, so tx=0. Compare with a plain equals check against "high". Don't lowercase, trim, or normalize anything.

How should I prepare for this in 48 hours?+

Practice frequency counting with a hash map and custom output formatting. Write it once end to end, including the empty-array case and sorted output. Check complexity against 100000 entries. That covers the whole problem.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Chainalysis.

OA at Chainalysis?
Invisible during screen share
Get it