Codility: MaxZeroProduct challenge and solution
You must consider domain boundaries: A can contain integers in the range [1..1,000,000,000] so the largest possible product would be 1,000,000,000^3 which is way beyond int.MaxValue (and even ulong.MaxValue). One way to overcome this problem while keeping you algorithm as is, is to use System.Numerics.BigInteger instead of int.



This conditional expression while (!(n &lt;= 0 || n % 10 != 0)) has its equivalent in while (n &gt; 0 &amp;&amp; n % 10 == 0) which I find more straight forward readable.



These nested loops can be optimized a little bit:


    for (var i = 0; i &lt; A.Length; i++) {
        for (var j = i + 1; j &lt; A.Length; j++) {
            for (var k = j + 1; k &lt; A.Length; k++) {



    for (var i = 0; i &lt; A.Length - 2; i++) {
        for (var j = i + 1; j &lt; A.Length - 1; j++) {
            for (var k = j + 1; k &lt; A.Length; k++) {