You are viewing a single comment's thread. Return to all comments →
I hope you all have solved the first problem of the DTCC challenge.
python 3
def countArr(n, k): if n >= k: result_arr = list(itertools.permutations([i for i in range(n)], k)) print(result_arr) result = len(result_arr) else: result_arr = list(itertools.product([i for i in range(n)], repeat=k)) result = len(result_arr) for item in result_arr: for i in range(len(item)-1): if item[i] == item[i+1]: result -= 1
break return result
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #9: Special Pythagorean triplet
You are viewing a single comment's thread. Return to all comments →
I hope you all have solved the first problem of the DTCC challenge.
python 3