Back to problems

High-Concurrency Prompt Template Deduplication (Array + Hash Map)

Algorithm · Anthropic · Medium

Problem: Deduplicate and Count Prompt Templates at High Throughput (Array + Hash Map) A prompt-platform service receives a large collection of prompt-template strings. To lower evaluation and cache overhead, normalize equivalent templates and tally how often each normalized form occurs. Given an array templates containing n entries, produce a mapping that associates every normalized template key with its count. Normalization rules Apply the following transformation to every…

Checking your access…