Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution {
- public:
- int arraySign(vector<int>& nums) {
- int res = 1;
- for(int x: nums){
- if(x)
- x = (x>0)? 1 : -1;
- res = res * x;
- }
- return res;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement