Write a function
tripledouble(num1,num2)
which takes in numbers num1 and num2 and returns 1 if there is a straight triple of a number at any place in num1 and also a straight double of the same number in num2.
For example:
tripledouble(451999277, 41177722899) == 1 // num1 has straight triple 999s and
// num2 has straight double 99s
tripledouble(1222345, 12345) == 0 // num1 has straight triple 2s but num2 has only a single 2
tripledouble(12345, 12345) == 0
tripledouble(666789, 12345667) == 1
If this isn't the case, return 0
'매일매일개발 > Codewars' 카테고리의 다른 글
codewars #73 Counting Duplicates (6kyu) (0) | 2018.07.05 |
---|---|
codewars #72 Moving Zeros To The End (5kyu) (0) | 2018.07.04 |
codewars #70 IQ Test (6kyu) (0) | 2018.07.02 |
codewars #69 Weight for weight (5kyu) (0) | 2018.06.28 |
codewars #68 Predict your age! (7kyu) (0) | 2018.06.27 |