We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • Hackerrank Home
  • Prepare
    NEW
  • Certify
  • Compete
  • Career Fair
  • Hiring developers?
  1. All Contests
  2. ProjectEuler+
  3. Project Euler #185: Number Mind

Project Euler #185: Number Mind

Problem
Submissions
Leaderboard
Discussions

This problem is a programming version of Problem 185 from projecteuler.net

The game Number Mind is a variant of the well known game Master Mind.

Instead of coloured pegs, you have to guess a secret sequence of digits. After each guess you're only told in how many places you've guessed the correct digit. So, if the sequence was and you guessed , you'd be told that you have one correct digit; however, you would NOT be told that you also have another digit in the wrong place.

For instance, given the following guesses for a -digit secret sequence,

; correct
; correct
; correct
; correct
; correct
; correct

The correct sequence is unique.

Based on the some guesses, find the unique -digit secret sequence.

Input Format

First line of every input file contains a single integer the number of guesses. lines follow each containing the -digit guess sequence and the number of correct digits for this guess .

Constraints

Output Format

Output the string with exactly digits the unique valid answer to the guesses.

Sample Input

20
228569150065 1
907564288621 0
496954400043 0
713459943615 0
211421327491 1
258317293172 0
919252724339 1
197103476352 0
151173430038 0
063794395936 0
504759866532 1
502906565456 0
790539816536 0
595873942664 1
346602334981 0
988808475766 1
559203789779 0
498580144863 1
441454897857 1
622818801178 0

Sample Output

884045122207

Author

bayleef

Difficulty

Medium

Max Score

100

Submitted By

613

Need Help?


View discussions
View top submissions

rate this challenge

MORE DETAILS

Download problem statement
Download sample test cases
Suggest Edits
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy