多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
# [914\. 卡牌分组](https://leetcode-cn.com/problems/x-of-a-kind-in-a-deck-of-cards/) ![](https://box.kancloud.cn/ac3adc0f0cb783239d275bcd110b1302_801x674.png) ~~~ func TestDemo914(t *testing.T) { data1 := []int{1,2,3,4,4,3,2,1} data2 := []int{1,1,1,2,2,2,3,3} fmt.Println(hasGroupsSizeX(data1)) fmt.Println(hasGroupsSizeX(data2)) } func hasGroupsSizeX(deck []int) bool { for _,v := range deck { b := esc(v, deck) if b == false{ return false } } return true } func esc(i int,ds []int) bool { var s int for _,v := range ds { if v == i { s ++ } } i2 := s % 2 if i2 == 0 { return true } return false } ~~~