GamifiedGamified challengesPracticeRaceLeaderboardPricing

Learn data structures by watching them move, then doing it yourself. Press M anytime to toggle sound.

A product of Amypo Technologies, Coimbatore.

Learn

  • All topics
  • Learning path
  • How it works
  • About dotprep

Practice

  • Practice arena
  • Daily challenge
  • Gamified challenges
  • Race mode
  • Leaderboard

Interview prep

  • Java interview
  • Coding questions
  • Company questions
  • System design
  • Jobs & careers

You

  • Dashboard
  • Settings
  • Pricing
  • Create account

© 2026 dotprep

Content last updated 20 November 2026

GamifiedGamified challengesPracticeRaceLeaderboardPricing
Log inStart free
Gamified challengesSwitch Challenge

Gamified challenge · Asked in Capgemini

Switch Challenge

A row of symbols passes through two switches that shuffle it. A switch's code is a string of the digits 1 to n: output position i takes the input symbol at position code[i] - 1, so code 2134 turns ABCD into BACD. You know the top row, the first switch's code and the bottom row that comes out of the second switch.

Write secondSwitch(top, first, bottom) (second_switch in Python) that returns the second switch's code. For "ABCD", "2134", "CBAD" the first switch gives BACD, so the answer is "3124".

Sign in to play Switch Challenge

This game is part of the paid plans. Sign in, then pick a plan to write your answer, watch it play out, and step through the algorithm with its guide.

Sign in with Google

or log in with email · create an account