Question bank › Hashing
Dsa Hashing Warm-up

Check for Straight Hand

You are given a poker hand consisting of 5 cards represented by their ranks. Your task is to determine if the hand is a 'straight' (i.e., all cards are consecutive values). The ranks are given as strings. Input format: - The first line contains a single integer N (always 5), the number of cards. - The second line contains N strings, where each string is the rank of the card (e.g., 'A', '2', '3', ..., 'K'). Output format: - Print 'YES' if the hand is a straight, otherwise print 'NO'. Example Input: 5 2 3 4 5 6 Example Output: YES

Key concepts

hashingcardssets

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.