第一题: public int minOperations (String str) { // write code here int[] count = new int[26]; for (char ch : str.toCharArray()) { count[ch - 'a']++; } int ans = 0; int sum = 0; for (int i = 0; i < 26; i++) { ans += count[i] / 2; count[i] %= 2; sum += count[i]; } if (ans + sum < 26) { return ans; } return ans + ans - (26 - sum); }
3 3

相关推荐

身边有人上海、深圳&nbsp;6、7k&nbsp;都去了,真就带薪上班了。
小浪_coder:深圳除了一些计算机,UI设计,金融类等一些可以月薪过万的工作之外, 认识很多朋友做运营,营销,文员的工作, 月薪基本都在4-6K左右,还有大把人在干
点赞 评论 收藏
分享
牛客38347925...:9,2学生暑期实习失利开始投小厂,给这群人整自信了
点赞 评论 收藏
分享
06-28 22:48
已编辑
广东金融学院 Java
小浪_Coding:学院本+这俩项目不是buff叠满了嘛
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务