• + 0 comments

    C#

        public static int jumpingOnClouds(List<int> c)
        {
            var count = 0;
            var i = 0;
            var n = c.Count;
    
            while (i < n - 1)
            {
                if (i + 2 < n && c[i + 2] == 0)
                {
                    i += 2;
                }
                else
                {
                    i += 1;
                }
                count++;
            }
    
            return count;
        }