Quest Global interview question

Code for .compare and tocompare methods