Typescript one liner
Intuition\nInitial thoughts were to approach as described: find the product and validate. \n\n# Approach\nRealised after writing a solution with initial thought
# Intuition\nInitial thoughts were to approach as described: find the product and validate. \n\n# Approach\nRealised after writing a solution with initial thoughts that could actually be simplified by checking/validating based on context resulting in expected products. E.g. if `0` exists then product will always be `0` or if there\'s an odd number of negative integers then it\'ll alaways end up at 0.\n\nAfter running a basic comparison of the two approaches it appeared that checking the underlying contexts was faster on larger arrays than using a reducer to find the product. After this I simplified the function down to a one liner.\n\n# Code\n```\nfunction arraySign(nums: number[]): number {\n    return nums.includes(0) ? 0 : !!(nums.filter((n) => n < 0).length % 2) ? -1 : 1;\n};\n```
['TypeScript']