find next greater number with same digits
def findnext(ii):
iis=list(map(int,str(ii)))
for i in reversed(range(len(iis))):
if i == 0: return ii
if iis[i] > iis[i-1] :
break
left,right=iis[:i],iis[i:]
for k in reversed(range(len(right))):
if right[k]>left[-1]:
right[k],left[-1]=left[-1],right[k]
break
return int("".join(map(str,(left+sorted(right)))))
Also in C++:
- gcc 7 install ubuntu
- ubuntu path of saving screenshots
- E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable) E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
- linux curl follow redirect
- linux change azert
- onworks ubuntu password
- batch token in vault
- install intellij linux command line
- zsh compinit: insecure directories, run compaudit for list.
- github how to add ssh key
- linux remove large folder
- how to access postgres CLI
- yarn clear cache
- windows echo environment variable
- bash params
- remove port iptables
- github see the username
- most git libya
- how to pull the latest changes from git
- git use ssh instead of https
- upgrade all content database sharepoint 2013 powershell
- ubuntu lemp
- what is regedit in windows
- git change default editor