Leetcode Everyday: 266. Palindrome Permutation
来源:互联网 发布:制作游戏用什么软件 编辑:程序博客网 时间:2024/04/29 15:36
https://leetcode.com/problems/palindrome-permutation/
Given a string, determine if a permutation of the string could form a palindrome.
For example,
"code"
-> False, "aab"
-> True, "carerac"
-> True.
public class Solution { public boolean canPermutePalindrome(String s) { char[] c = s.toCharArray(); int[] i = new int[128]; for(char cc: c){ i[(int) cc]+=1; } boolean flag = true; for(int ii: i){ if(ii%2!=0){ if(flag) flag=false; else return false; } } return true; }}
Only at most one character's occurrence can be odd. Suppose charset is ASCII
0 0
- Leetcode Everyday: 266. Palindrome Permutation
- Leetcode - 266. Palindrome Permutation
- LeetCode 266. Palindrome Permutation
- [leetcode] 266. Palindrome Permutation 解题报告
- LeetCode 266. Palindrome Permutation(对称排列)
- Leetcode 266. Palindrome Permutation (Easy) (cpp)
- [Leetcode] 266. Palindrome Permutation 解题报告
- Leetcode: Palindrome Permutation
- *LeetCode-Palindrome Permutation
- [LeetCode 266]Palindrome Permutation
- [Leetcode 266] Palindrome Permutation
- LeetCode 题解(241) : Palindrome Permutation
- Leetcode NO.266 Palindrome Permutation
- [Leetcode] Palindrome Permutation 回文变换
- [LeetCode 267] Palindrome Permutation II
- LeetCode 267. Palindrome Permutation II
- LeetCode 267. Palindrome Permutation II
- Leetcode Palindrome Permutation I & II
- iOS中的单例模式
- DIV+CSS和Table区别
- Python yield coroutine
- php之curl(Client URL Library)简介
- Properties类与配置文件
- Leetcode Everyday: 266. Palindrome Permutation
- [心情随笔]转行之前的一些想法
- 让人纠结的几何——《数学是什么》读书笔记(4)
- ACM-2014 青年歌手大奖赛_评委会打分
- 项亮《推荐系统实践》读书笔记2-推荐系统冷启动问题
- 五大常用算法
- 笔记Java基础
- iOS手势识别:识别原理和自定义手势识别
- 产品设计弹窗时的原则是什么