leetcode 696 Count Binary Substrings
2017-10-18 15:58
218 查看
class Solution { public int countBinarySubstrings(String s) { int fir=0,sec=1,ans=0; for(int i=1;i<s.length();i++){ if(s.charAt(i)==s.charAt(i-1)) sec++; else{ fir=sec; sec=1; } if(fir>=sec) ans++; } return ans; } }
相关文章推荐
- LeetCode-696-Count Binary Substringss-E
- Leetcode 696 Count Binary Substrings
- LeetCode -- Count of Smaller Numbers After Self
- Count and say[easy on LeetCode]
- leetcode---Count Primes---素数筛法的改进
- leetcode Count of Smaller Numbers After Self
- LeetCode222——Count Complete Tree Nodes
- 【leetcode】Count and Say
- LeetCode-Count Complete Tree Nodes
- [leetcode] 222 Count Complete Tree Nodes
- Leetcode(59)-Count Primes
- LeetCode之Count Primes
- LeetCode Count and Say
- [LeetCode]038-Count And Say
- Count and Say -- Leetcode
- 【leetcode】Count Complete Tree Nodes -C++
- [leetcode-357]Count Numbers with Unique Digits(java)
- leetcode刷题日记—— Count Primes
- LeetCode题解:Count Primes
- Leetcode: Count Univalue Subtrees