Created
March 22, 2021 06:38
-
-
Save ashleighbasil/0a72f6f4ec15da12e00c4d8fe6478b32 to your computer and use it in GitHub Desktop.
Cassido broken solution!
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
def digits_list_to_int(digits): | |
return int("".join([str(i) for i in digits])) | |
def max_num(n, m, k): | |
return digits_list_to_int( | |
sorted(n + m)[::-1][:k] | |
) | |
def max_num_uniq(n, m, k): | |
return digits_list_to_int( | |
sorted(set(n + m))[::-1][:k] | |
) | |
n = [3,4,6,5] | |
m = [9,0,2,5,8,3] | |
k = 5 | |
print(max_num(n, m, k)) # 98655 | |
print(max_num_uniq(n, m, k)) # 98654 | |
# The right answer should be 98653?? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment