SCRTCODE - Editorial

PROBLEM LINK:

Practice
Contest

Author: Harshit Sharma
Tester: Sudhanshu Gupta
Editorialist: Sudhanshu Gupta

DIFFICULTY:

EASY

PREREQUISITES:

Greatest Common Divisor

PROBLEM:

Given two binary strings S1 and S2, tell if a binary string K exists, such that continuously subtracting K from both S1 and S2 results in K.

QUICK EXPLANATION:

Check if GCD of S1 and S2 exists, other than 1.

EXPLANATION:

First convert the binary strings to integers. Then, simply find if the GCD of the two integers is > 1. If it is, then secret binary code are same, else not.

SOLUTIONS:

Solution can be found here.

//