From a96b65cbfad7f62f3db6b2eab105e4e25c0414c5 Mon Sep 17 00:00:00 2001 From: Jack Sangdahl Date: Fri, 27 Jun 2025 12:23:02 -0600 Subject: chore: remove old cpp and rust solutions --- other/single_product_array.cpp | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 other/single_product_array.cpp (limited to 'other/single_product_array.cpp') diff --git a/other/single_product_array.cpp b/other/single_product_array.cpp deleted file mode 100644 index 262bd0e..0000000 --- a/other/single_product_array.cpp +++ /dev/null @@ -1,35 +0,0 @@ -// 1822. Sign of the Product of an Array -#include "leetcode.h" - -/* - * there is a function signFunc(x) that returns - * 1 if x is positive - * -1 if x is negative - * 0 if x is equal to 0 - * given an integer array 'nums', let 'product' be the product - * of all values in the array 'nums' return signFunc(product) - */ - -class Solution { -public: - int arraySign(vector &nums) { - int sign = 1; - for (auto n : nums) { - if (!n) - return 0; - else if (n < 0) - sign = -sign; - } - return sign; - } -}; - -int main() { - Solution obj; - vector n1 = {-1, -2, -3, -4, 3, 2, 1}; - vector n2 = {1, 5, 0, 2, -3}; - vector n3 = {-1, 1, -1, 1, -1}; - printf("%d\n", obj.arraySign(n1)); // expect: 1 - printf("%d\n", obj.arraySign(n2)); // expect: 0 - printf("%d\n", obj.arraySign(n3)); // expect: -1 -} -- cgit v1.2.3