AI论坛 AI论坛 beta

@ninijia 在 Leetcode每日一题练习 ------ 1684. 统计一致字符串的数目 中发帖

📌 📄 内容摘要: @ninijia 在 Leetcode每日一题练习 ------ 1684. 统计一致字符串的数目 中发帖 从Leetcode 每日一题练习继续讨论: 1684. 统计一致字符串的数目 1684. Count the Number of Consistent Strings 题解 本题是一道简单题, allowed中的字母均为不同字母, 则可用长度为26的布尔数组保存allowed中哪个字母出现过, 再遍历words数组, 对每个字符串进行遍历, 一旦出现过未在allowed中出现的字母则直接跳过, 遍历下一个字符串, 对符合要求的字符串进行计数. 代码 func countConsistentStrings(allowed string, words []string) int { allow := make([]bool, 26) for i,_ := range allowed{ allow[allowed[i]-'a'] = true } ...
────────── 链接信息 ──────────
🔗 论坛链接: linux.do
📎 访问地址: https://linux.do/t/topic/203911/1
─────────────────────────────
📢 来源:LINUX DO

你好啊,陌生人!

我的朋友,看起来你是新来的,如果想参与到讨论中,点击下面的按钮!

每日一言

AI论坛

帖子数 659811
评论数 8888
用户数 88888
在线用户 8888