Skip to content

Latest commit

 

History

History
38 lines (28 loc) · 790 Bytes

_1822. Sign of the Product of an Array.md

File metadata and controls

38 lines (28 loc) · 790 Bytes

All prompts are owned by LeetCode. To view the prompt, click the title link above.

Back to top


First completed : June 06, 2024

Last updated : July 01, 2024


Related Topics : Array, Math

Acceptance Rate : 65.34 %


Solutions

C

int arraySign(int* nums, int numsSize) {
    bool out = true;
    for (int i = 0; i < numsSize; i++) {
        if (nums[i] < 0)
            out = !out;
        if (!nums[i])
            return 0;
    }
    return out ? 1 : -1;
}