题解 | #字符串构成#
字符串构成
https://www.nowcoder.com/practice/4b05c1f9f0094f86aa14649485e9e9eb
package main /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param des string字符串 * @param src string字符串 * @return bool布尔型 */ func canConstruct( des string , src string ) bool { // write code here charCount := make(map[rune]int) for _,v := range src{ charCount[v]++ } for _,v := range des{ if charCount[v] == 0{ return false } charCount[v]-- } return true }