Geeksforgeeks

X

DAYS

:

HOUR

:

MINS

:

SEC

Error

Copied to Clipboard

You will be given two numbers **a** and **b**. Your task is to print 1 if **a** < **b**, print 2 if **a** > **b** and print 3 if **a** = **b**.

**Example 1:**

**Input: **
a = 1234
b = 12345
**Output: **1
**Explanation: **a < b so answer is 1.

**Example 2:**

**Input:
**a = 100
b = 1
**Output: **2
**Explanation: **a > b, so answer is 2.

**User Task:**

Your task is to complete the function **check() **which takes 2 arguments(string a, string b) and returns the answer. You need not take input or print anything.

**Expected Time Complexity: **O(|a| + |b|).

**Expected Auxiliary Space: **O(|a| - |b|).

**Constraints:**

1 ≤ |**a|**, |**b|** ≤ 155^{ }

'0' ≤ a_{i},b_{i } ≤ '9'

We are replacing the old Disqus forum with the new Discussions section given below.

Click here to view old Disqus comments.

Click here to view old Disqus comments.

Login to report an issue on this page.

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

YesLoading...

Compare two Large Numbers

...