Created
          March 27, 2019 14:31 
        
      - 
      
- 
        Save foo4u/2370eb1f6bd3d7ca468d0d498e827c61 to your computer and use it in GitHub Desktop. 
    Coding Bat
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | public int countClumps(int[] nums) { | |
| int clumps = 0; | |
| int last = -1; | |
| int run = 0; | |
| for(int i = 0; i< nums.length; i++) { | |
| if (last == nums[i]) { | |
| if(run < 1) { | |
| clumps++; | |
| } | |
| run++; | |
| } else { | |
| run = 0; | |
| } | |
| last = nums[i]; | |
| } | |
| return clumps; | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment