0
Can i remove a negative number by using ArrayList.
I want the product of an array number not to be a negative number. About this problem I split it in 2 situations 1: if total of array number have an zero number and we no need to do anything. The output is zero 2: if a product of number may be positive or negative. - if positive, we no need to remove anything just like one situation. - if negative and total of negative number %2==0, the output is zero . In contrast, the total of negative number %2 != 0 , all we need is just remove one element
3 Answers
+ 1
I'd like to understand this problem a little better.
If array is [1, 2, -3, 4]
Multiplying them together would give -24.
Would you like this number to be 24? (positive instead of negative)
Or would you like to filter the array so it becomes [1, 2, 4]
0
I ' d like a second . can you help me
0
Do you have an example
input = ?
expected output = ?