Created
December 29, 2016 12:29
-
-
Save kenduigraha/399a72fe04041953ab3615e4af600b0d 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 munculSekali(input) { | |
input = input.toString() | |
var flag = 0 | |
var result = [] | |
for(var i = 0 ; i < input.length ; i++){ | |
flag = 0 | |
for(var j = 0 ; j < input.length ; j++){ | |
if(i !== j){ | |
if(input[i] !== input[j]){ | |
flag += 0 | |
}else{ | |
flag ++ | |
} | |
} | |
} | |
if(flag === 0){ | |
result.push(input[i]) | |
} | |
} | |
return result | |
} | |
console.log(munculSekali(1234123)) | |
console.log(munculSekali(76523752)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment