(String s)
| 1 | class Solution { |
| 2 | public long minimumSteps(String s) { |
| 3 | int n=s.length(); |
| 4 | int last=0; |
| 5 | long swapCount=0; |
| 6 | for(int cur=0;cur<n;cur++){ |
| 7 | if(s.charAt(cur) == '0'){ |
| 8 | swapCount+=(cur-last); //imag swapping |
| 9 | last++; |
| 10 | } |
| 11 | } |
| 12 | return swapCount; |
| 13 | } |
| 14 | } |
nothing calls this directly
no outgoing calls
no test coverage detected