Last active
          March 2, 2017 07:30 
        
      - 
      
- 
        Save Underdoge/a10f6e913a4e10fa488009f2e7dd9f91 to your computer and use it in GitHub Desktop. 
    palindromeRearranging
  
        
  
    
      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
    
  
  
    
  | function palindromeRearranging(inputString) { | |
| var palindrome=true; | |
| var center=0; | |
| var array=inputString.split(""); | |
| while(palindrome&&array.length>0){ | |
| if(array.indexOf(array[0],1)>0) | |
| array.splice(array.indexOf(array[0],1),1); | |
| else | |
| if(center<1) | |
| center++; | |
| else | |
| palindrome=false; | |
| array=array.slice(1); | |
| } | |
| return palindrome; | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment