Answers for "Check if Numbers Are Ascending in a Sentence"

0

Check if Numbers Are Ascending in a Sentence

class Solution:
    def areNumbersAscending(self, s: str) -> bool:
        letter = [int(i) for i in s.split() if i.isdigit()] # splitting & checking the if it's digit
        for i in range(len(letter)): 
            for j in range(i + 1, len(letter)):
                if letter[i] >= letter[j]:
                    return False
        return True
Posted by: Guest on October-17-2021

Code answers related to "Check if Numbers Are Ascending in a Sentence"

Browse Popular Code Answers by Language