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.
defseparateNumbers(s):# Write your code herefirst=-1foriinrange(1,(int((len(s)+1)/2)iflen(s)%2!=0elseint(len(s)/2)+1)):digits=[cforcins]this_num="".join(digits.pop(0)forxinrange(i))ifint(this_num)>=1:first=int(this_num)else:continuewhiledigits:next_num=str(int(this_num)+1)if''.join(digits[:len(next_num)])!=next_num:breakelse:digits=digits[len(next_num):]this_num=next_numnext_num=str(int(next_num)+1)else:returnprint("YES",first)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 →
this was definitely on the harder side of "easy."