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
'use strict'; | |
// this function creates an M+1xN+1 matrix where M is the length of the first string | |
// and N is the length of the second string and computes the number of changes it would | |
// require to convert string s to string t. The value at point (i,j) is the cost to | |
// compute s from [0..i] to t from [0..j] | |
function levenshtein(s, t) { | |
var m = s.length + 1; | |
var n = t.length + 1; |
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
from itertools import product | |
if __name__ == '__main__': | |
selections = 10 | |
blanks = 2 | |
select_range = range(1, selections+1) | |
all_unique = 0 |
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
def get_digits(num): | |
rem = num % 10 | |
it_num = num/10 | |
digits = [] | |
while(rem > 0 or it_num > 0): | |
if rem in digits: return None | |
digits.insert(0, rem) | |
rem = it_num % 10 | |
it_num = it_num/10 | |
return num |
NewerOlder