MCPcopy Create free account
hub / github.com/HuberTRoy/leetCode / makeEqual

Method makeEqual

Array/LargestNumber.py:69–75  ·  view source on GitHub ↗
(s, length=max_nums)

Source from the content-addressed store, hash-verified

67
68 # 测试用下面的可以跑过 2 & 3。
69 def makeEqual(s, length=max_nums):
70
71 if len(s) == length:
72 return s
73 # 这种补位会通过测试,但是 Leetcode 的测试并没有包含所有的情况。
74 x = max(s) * (length - len(s))
75 return s+x
76
77 # 2
78 return ''.join(sorted(map(str, nums), cmd=mycmp, reverse=True))

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected