Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

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)))))
Comment

PREVIOUS NEXT
Code Example
Shell :: windows command line connect to bluetooth device 
Shell :: flutter release mode 
Shell :: install thefuck for ubuntu 
Shell :: install kubectl on ubuntu 20 
Shell :: renaming a file github 
Shell :: git push not working 
Shell :: adonis run specific seeder 
Shell :: bash timeout 
Shell :: git push ubuntu need to supply email and password everytime 
Shell :: how to chnage kubectl to k 
Shell :: xubuntu desktop 
Shell :: wsl linux compress siez 
Shell :: vim no space 
Shell :: how slice for loop filename without extension in batch file 
Shell :: prisjakt 
Shell :: https://cloud.google.com/shell/docs/using-web-preview#previewing_the_application 
Shell :: get-adcomputer servers only 
Php :: kill phpstorm 
Php :: phpmailer utf8 charset encoding 
Php :: get current page url in php 
Php :: drupal 8 add message 
Php :: downgrade php 7.4 to 7.3 mac 
Php :: remove html tags from string php 
Php :: protected table laravel 
Php :: laravel check collection not empty 
Php :: __construct 
Php :: php artisan migrate create table 
Php :: clear bootstrap cache laravel 
Php :: php unset session variable 
Php :: php password validation preg_match 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =