Skip to content

Instantly share code, notes, and snippets.

@youngdo212
Created July 12, 2018 08:57
Show Gist options
  • Save youngdo212/8b3d9e59366cee84d52849fc09e3ca3d to your computer and use it in GitHub Desktop.
Save youngdo212/8b3d9e59366cee84d52849fc09e3ca3d to your computer and use it in GitHub Desktop.
function solution(s){
let {length} = s;
while(length){
for(let i = 0; i + length <= s.length; i++){
if(isPalin(s.slice(i,i+length))) return length;
}
length--
}
}
function isPalin(s){
for(let i = 0, {length} = s; i < length/2; i++){
if(s[i] !== s[length-1-i]) return false
}
return true;
}
@youngdo212
Copy link
Author

하드코딩...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment