We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Would rather use more Pythonic style, for example:
def biggerIsGreater(s):
for i in range(len(s)-1)[::-1]:
if s[i] < s[i+1]:
for j in range(i+1,len(s))[::-1]:
if s[i] < s[j]:
lis = list(s)
lis[i],lis[j]=lis[j],lis[i]
return "".join(lis[:i+1]+lis[i+1:][::-1])
return 'no answer'
Bigger is Greater
You are viewing a single comment's thread. Return to all comments →
this code like in C
Would rather use more Pythonic style, for example:
def biggerIsGreater(s):