标签:i++ 集合 color als == 连续 判断 style lse
/// <summary> /// 判断数字集合是否是连续的 /// </summary> /// <returns></returns> public bool IsContinuous(List<int> numList) { numList.Sort((x, y) => -x.CompareTo(y));//降序 bool result = false; for (int i = 0; i < numList.Count(); i++) { if (numList[i] - numList[i + 1] == 1) result = true; else { result = false; break; } } return result; }
标签:i++ 集合 color als == 连续 判断 style lse
原文地址:https://www.cnblogs.com/gilbert/p/10936407.html