922. Check Whether a Number is Positive or Negative

Given an integer n, determine whether it is Positive, Negative, or Zero.

Return the string:

  • "Positive" if n > 0
  • "Negative" if n < 0
  • "Zero" if n == 0

Example 1:

Input: n = 5

Output: "Positive"

Example 2:

Input: n = -5

Output: "Negative"

Now Your Turn!

Pick the correct output for the given input

Input: n = 0

Still unsure what the problem is asking ?

Let’s go through a few more examples, step by step, to make it clearer.

Constraints:

  • 109 <= n <= 109
0
class Solution {
public:
string checkNumberSign(int n) {
// Your code goes here
}
};
 
Test Case

Input:

N