Comparison

Learn how to compare huge integers.

In a previous lesson, we solved the problem of adding and subtracting. Now, let’s talk about comparison.

Your implementation

Write your implementation here for practice:

 3
0001273
389
600
Comparison

Comparison

In comparison, we’ll implement the following:

  • Less than
  • Greater than
  • Equal to

Before moving towards the implementation, let’s discuss a small issue that might arise when comparing two numbers. Consider the scenario where we have two numbers:

Number 1: 1234
Number 2:  234

Which of these two numbers is greater when compared based on their respective number of digits? Since 12341234 has a length of four and 234234 ...