(String str)
| 1 | public static int binString(String str) |
| 2 | { |
| 3 | int countZero=0; |
| 4 | int countOne=0; |
| 5 | int ans=0; |
| 6 | for(int i=0;i<str.length();i++) |
| 7 | { |
| 8 | if(str.charAt(i)=='0') countZero++; |
| 9 | else countOne++; |
| 10 | |
| 11 | if(countOne==countZero) |
| 12 | { |
| 13 | ans++; |
| 14 | countZero=0; |
| 15 | countOne=0; |
| 16 | } |
| 17 | } |
| 18 | return (ans==0)?-1:ans; |
| 19 | } |
nothing calls this directly
no outgoing calls
no test coverage detected