Skip to content

Commit

Permalink
py sol for cf-632C
Browse files Browse the repository at this point in the history
  • Loading branch information
freakin23 committed Nov 19, 2024
1 parent 1f3d057 commit 178b9e4
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions solutions/silver/cf-632C.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,26 @@ public class Smallest {
```

</JavaSection>
<PySection>

```py
from functools import cmp_to_key

n = int(input())
inps = []
for _ in range(n):
inps.append(input())

def compare(x, y):
if x + y > y + x: # y should come before x
return 1
elif x + y < y + x: # x should come before y
return -1
return 0 # x and y are equal

inps.sort(key = cmp_to_key(compare))
print(''.join(inps))
```

</PySection>
</LanguageSection>

0 comments on commit 178b9e4

Please sign in to comment.