剑指offer---扑克牌的顺子
class Solution { public: bool IsContinuous(vector<int> numbers) { int max_num = -1; int min_num = 14; int in_size = numbers.size(); if (in_size != 5) return false; for (int i = 0; i < in_size; ++i) { max_num = max(numbers[i], max_num); } for (int i = 0; i < in_size; ++i) { if ((numbers[i] < min_num) && (numbers[i] != 0)) { min_num = numbers[i]; } } int flag = 0; for (int i = 0; i < in_size; ++i) { for (int j = (i + 1); j < in_size; ++j) { if ((numbers[i] == numbers[j]) && (numbers[i] != 0)) { flag = 1; } } } if( (max_num - min_num < 5)&&(flag==0)) { return true; } else return false; } };