Cross-reference logs to flag spam numbers
Company: Pinterest
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: Medium
Interview Round: Onsite
You are given two data sets:
(
1) a call log containing phone numbers observed in calls and
(
2) a list of user reports where each entry is a phone number reported as spam (potentially with duplicates). Parse and cross-reference these inputs to output each spam phone number present in the call log and the number of times it was reported. Describe the algorithm, data structures (e.g., hash maps), handling of invalid numbers, and time/space complexity. Provide code in your preferred language.
Quick Answer: This question evaluates proficiency with data structures (such as hash maps), parsing and deduplication, frequency counting, input validation, and analysis of time and space complexity.