537.Compare Two Numbers with Relational Operators
Easy
Given two integers
a and b, evaluate the six relational operatorsRelational OperatorsOperators that compare two values and produce true or false: ==, !=, <, <=, >, >=. on them in the order ==, !=, <, <=, >, >=, and return 1 for each true comparison and 0 for each false one.
Every if and every loop condition is built from these comparisons. The second solution shows that they are not independent: once you know whether a equals b and whether a is less than b, the other four follow by combining or negatingNegationFlipping a boolean: true becomes false and false becomes true (the ! operator, or not in Python). those two.
Example 1:
Input: a = 4, b = 9
Output: [0,1,1,1,0,0]
Example 2:
Input: a = 6, b = 6
Output: [1,0,0,1,0,1]
+ 5 hidden test cases run on Submit.
Constraints:
- ●
-1000000 ≤ a, b ≤ 1000000
a =
4
b =
9