using System; using System.Collections.Generic; class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param numbers int整型一维数组 * @return bool布尔型 */ public bool IsContinuous (List<int> numbers) { // write code here numbers.Sort(); int nIndexFind = numbers.FindLastIndex(r => r == 0); int nZeroCount = nIndexFind + 1; int nMinVal = numbers[nIndexFind + 1]; for (int nIndex = 0; nIndex < 5; nIndex++) { int nIndexE = numbers.FindIndex(r => r == nMinVal + nIndex); if (nIndexE >= 0) continue; if (nZeroCount > 0) { nZeroCount--; continue; } return false; } return true; } }