I hereby claim:
- I am rhyn0bytes on github.
- I am rhyno (https://keybase.io/rhyno) on keybase.
- I have a public key whose fingerprint is E37C FEE0 6987 30AD FE50 7CE7 31B2 43A2 88B8 37C8
To claim this, I am signing this object:
import re | |
start = 387638 | |
finish = 919123 | |
count1 = 0 | |
count2 = 0 | |
def isAscending(num): | |
prev = 10 |
count1 = 0 | |
count2 = 0 | |
for i in 245318..765747 # loop through rang of problem to solve 6-digit and range inclusion requirements | |
validFound = false | |
digits = i.to_s.split('') # Converting number to array of digits for easier sorting | |
if digits == digits.sort # Validate number is in ascending order | |
if i.to_s.match(/(\d)\1/) # If at least 1 pair of consecutive digits, valid for part one | |
count1 += 1 | |
i.to_s.scan(/(\d)\1/).each do |m| # Iterate through all pairs of matching digits | |
if !i.to_s.match(/(#{m[0]})\1{2,}/) # Reject code if pair is part of a large match |
I hereby claim:
To claim this, I am signing this object: