6 kyu
Simple Fun #258: Is Divisible By 6
403 of 1,214myjinxin2015
Description:
Task
A masked number is a string that consists of digits and one asterisk (*
) that should be replaced by exactly one digit. Given a masked number s
, find all the possible options to replace the asterisk with a digit to produce an integer divisible by 6.
Input/Output
[input]
string s
A masked number.
1 ≤ inputString.length ≤ 10000.
[output]
a string array
Sorted array of strings representing all non-negative integers that correspond to the given mask and are divisible by 6.
Example
For s = "1*0"
, the output should be ["120", "150", "180"].
For s = "*1"
, the output should be [].
For s = "1234567890123456789012345678*0"
,
the output should be
[
"123456789012345678901234567800",
"123456789012345678901234567830",
"123456789012345678901234567860",
"123456789012345678901234567890"]```
As you can see, the masked number may be very large ;-)
Puzzles
Similar Kata:
Stats:
Created | May 9, 2017 |
Published | May 9, 2017 |
Warriors Trained | 2061 |
Total Skips | 31 |
Total Code Submissions | 5657 |
Total Times Completed | 1214 |
JavaScript Completions | 403 |
Ruby Completions | 97 |
Crystal Completions | 8 |
Python Completions | 742 |
Total Stars | 42 |
% of votes with a positive feedback rating | 92% of 331 |
Total "Very Satisfied" Votes | 289 |
Total "Somewhat Satisfied" Votes | 33 |
Total "Not Satisfied" Votes | 9 |
Total Rank Assessments | 9 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 8 kyu |