You are viewing a single comment's thread. Return to all comments →
Key Idea: create a string and compare, rather than go through each element in string.
def separateNumbers(s): # Write your code here if len(s) == 1: print("NO") return for i in range(1, len(s)//2 + 1): curStr = s[:i] curNum = int(s[:i]) while len(curStr) < len(s): curNum += 1 curStr += str(curNum) if curStr == s: print("YES "+ s[:i]) return print("NO") return
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 →
Key Idea: create a string and compare, rather than go through each element in string.