Created
August 13, 2013 07:44
-
-
Save KKrisu/6218758 to your computer and use it in GitHub Desktop.
This file contains 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 getHash (v) { | |
return v.x+'-'+v.y+'-'+v.z; | |
} | |
function solve(input) { | |
var l = input.length, | |
map = {}; | |
while(l--) { | |
map[getHash(input[l])] = l; | |
} | |
l = input.length; | |
while(l--) { | |
if( map[ getHash(input[l]) ] > -1 && map[ getHash(input[l]) ] !== l ) { | |
return true; | |
}; | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment