Question bank › Two Pointers
Dsa Two Pointers Easy

Crossroad Detection

You are given a linked list representing a path in a city, where each node has the x and y coordinates of intersections. Your task is to determine if there are two nodes (intersections) that have the same coordinates. If they do, print 'CROSSROAD', otherwise print 'SAFE'. Input: - The first line contains an integer n (1 <= n <= 100) - the number of intersections. - The next n lines contain two integers x (0 <= x <= 100) and y (0 <= y <= 100) - the coordinates of each intersection. Output: - Print 'CROSSROAD' if there are duplicates, otherwise print 'SAFE'. Example: Input: 4 0 1 1 2 0 1 2 3 Output: CROSSROAD If there are intersections with the same coordinates, we consider it as a crossroad.

Key concepts

two_pointerslistlinked_list

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.