CHOPRT - Editorial

Problem Link - Chef And Operators Practice Problem in 500 to 1000 difficulty problems

Problem Statement:

Chef is learning about relational operators, which are used to compare two numerical values. The task is to determine the relationship between two given integers A and B. For each pair of numbers, you need to output one of the following:

  • ‘<’ if A is less than B
  • ‘>’ if A is greater than B
  • ‘=’ if A is equal to B

Approach:

The problem can be solved by a straightforward comparison using conditional statements.

  • Compare A and B using basic conditional checks:
    • If A<B, print '<'.
    • If A>B, print '>'.
    • If A==B, print '='.

Complexity:

  • Time Complexity: O(1) using the conditional statements.
  • Space Complexity: O(1) No extra space is used.