Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 39796

JARVIS - Editorial

$
0
0

PROBLEM LINK:

PracticeContest

Author:Varun Singh

DIFFICULTY:

SIMPLE

PREREQUISITES:

Ad-Hoc

PROBLEM:

Given a pattern, determine whether or not, there is a different PIN that has the same pattern.

EXPLANATION:

If the given string (configuration) touches all four sides of the keyboard, then answer will be "YES", else "NO". Upper side contains 1,2,3 , left: 1,4,7,0 , right: 3,6,9,0 , lower:7,0,9.
Alternatively, We can try out all of the possible starting digits, seeing if we will go out of bounds by repeating the same movements. If it is valid and different from the correct one, we output "No", otherwise we just output "Yes".

AUTHOR'S SOLUTIONS:

Author's solution can be found here.


Viewing all articles
Browse latest Browse all 39796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>