All 5-way products that include a zero term are themselves zero. If your current greatest is greater than zero then on first encountering a zero element in the input array, you could reset your...
Type: Posts; User: Sean4u
All 5-way products that include a zero term are themselves zero. If your current greatest is greater than zero then on first encountering a zero element in the input array, you could reset your...
Absolutely right - I didn't see that one coming! It's going to make the loop look a bit messier, but you could check for 'a zero leaving the window' and recalculate the 5-way product. I can't think...
Urban Dictionary: op
I meant the first definition, unless urbandictionary presents the page to you in a different order.
That is the answer to the question you asked. You'll need to do this each time around the loop, but I held off pointing out yesterday that you were creating a list of results for a problem that said...
If you loop for every element in your input integer array, you can multiply your product variable by the current element each time. If the current element is placed 4 or higher, you output the...
The reason OP is using constant array index increments is because of my suggestion to 'slide a window':...