⌘K
Flycodx

Temple Darshan VIP Queue Priority

Temple Darshan VIP Queue Priority

MediumArrays0% accepted

At Delhi's Iskcon temple, Meera manages the darshan queue. She has N devotees with some marked as VIP (special occasions). She must move all VIPs to the front while keeping non-VIPs in their original relative order.

Approach

Given an array where each element is 'name:flag' (0 or 1), move all VIPs to front maintaining original relative order of both groups.

Input

5 Ravi:0 Priya:1 Arjun:0 Meera:1 Karan:0

Output

Priya Meera Ravi Arjun Karan
solution.py
Loading editor...
Test 1
Test 2
Test 3

Press Run to test your custom input, or Submit to judge against all test cases.

Sign in to continue

Create a free account to run code, submit solutions and track progress.

  • Free forever — no credit card
  • 10+ languages with live execution
  • Points, streaks & leaderboards
Auto Save OnLn 1, Col 1Spaces: 4UTF-8LFPython 3