From a900a18ece89b9f88d4d624e16719ef6d0dd7c79 Mon Sep 17 00:00:00 2001 From: isinsuarici Date: Thu, 9 Mar 2023 00:32:21 +0300 Subject: [PATCH] Q1822 added. --- E_1822_SignoftheProductofanArray.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 E_1822_SignoftheProductofanArray.java diff --git a/E_1822_SignoftheProductofanArray.java b/E_1822_SignoftheProductofanArray.java new file mode 100644 index 0000000..0aafc0c --- /dev/null +++ b/E_1822_SignoftheProductofanArray.java @@ -0,0 +1,12 @@ +class Solution { + public int arraySign(int[] nums) { + int ret=1; + for (int num: nums){ + if(num==0) + return 0; + if(num<0) + ret= -ret; + } + return ret; + } +} \ No newline at end of file