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.
defisBeautiful(s,x):iflen(s)==0orlen(s)==x:returnTruecurr=s[0:x]next=s[x:x+len(str(int(curr)+1))]ifint(curr)+1==int(next):returnisBeautiful(s[x:],len(next))else:returnFalsedefseparateNumbers(s):foriinrange(1,len(s)// 2 + 1): #Setting digits of first numberifisBeautiful(s,i):print("YES",s[:i])returnprint("NO")
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Separate the Numbers
You are viewing a single comment's thread. Return to all comments →
Python