File tree 1 file changed +4
-7
lines changed
1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change 1
- #!/usr/bin/python
2
- # -*- coding: utf-8 -*-
3
-
4
1
"""
5
2
Source: https://www.instagram.com/p/CG7kv65A6s1/?utm_source=ig_web_copy_link
6
3
The following function accepts 2 positive integers
19
16
"""
20
17
21
18
22
- def maximum_combination (first_num , second_num ):
19
+ def maximum_combination (first_num , second_num ) -> int :
23
20
if first_num <= 0 :
24
21
return 0
25
22
if second_num <= 0 :
26
23
return first_num
27
24
second_num = [int (x ) for x in str (second_num )]
28
25
first_num = [int (x ) for x in str (first_num )]
29
26
second_num .sort (reverse = True )
30
- for ( index , val ) in enumerate (first_num ):
27
+ for index , val in enumerate (first_num ):
31
28
if len (second_num ) > 0 :
32
29
if second_num [0 ] > val :
33
30
first_num [index ] = second_num [0 ]
34
31
second_num .pop (0 )
35
32
else :
36
33
break
37
- return int ('' .join (map (str , first_num )))
34
+ return int ("" .join (map (str , first_num )))
38
35
39
36
40
- if __name__ == ' __main__' :
37
+ if __name__ == " __main__" :
41
38
from doctest import testmod
42
39
43
40
testmod ()
You can’t perform that action at this time.
0 commit comments