💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
# [17\. 电话号码的字母组合](https://leetcode-cn.com/problems/letter-combinations-of-a-phone-number/) ![](https://box.kancloud.cn/856d67491593b49e08f497c3ef508074_676x409.png) ~~~ func TestDemo17(t *testing.T) { data := []int{1,2,3} fmt.Println(data[2:]) //data := []interface{} {"abc","abd","ghi"} //js(data) } func js(data []interface{}) { switch data[0].(type) { case string: rest := []string{} for _,v := range data[0].(string) { for _,v2 := range data[1].(string) { dat := string(v) + string(v2) rest = append(rest,dat) dats := data[1:] } } case []string: rest := []string{} for _,v := range data[0].([]string) { for _,v2 := range data[1].(string) { dat := string(v) + string(v2) rest = append(rest,dat) data[0] = rest } } } if len(data) > 1 { js(data) }else{ fmt.Println(data) } } ~~~