Question bank › Hashing
Dsa Hashing Warm-up

Count Stock Tickers

You are given a list of stock ticker symbols along with their counts indicating how many times they appear in the stocks bought or sold. Your task is to count the total occurrences of each ticker symbol and print them in a specific format. Input format: - The first line contains an integer N (1 ≤ N ≤ 1000), the number of ticker symbols. - The next N lines each contain a string, the ticker symbol. Output format: - Print each ticker symbol followed by its count. Each output should be on a new line in the format: 'TICKER COUNT'. Example Input: 4 AAPL GOOGL AAPL MSFT Example Output: AAPL 2 GOOGL 1 MSFT 1

Key concepts

hashingdictionariescounting

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.