math - Are these test cases correct? -


while working on google foobar problems, ran 1 following prompt:

professor boolean, notorious mad scientist, found out precious rabbit specimen has escaped! rushes call security minions on lab phone. however, rabbit escapee hacked phone speed escape! left sign following clues: each digit dialed has number can reached knight chess piece last digit dialed - is, must move precisely 2 spaces in 1 direction, , 1 space in perpendicular direction dial next correct number. can dial number want start with, subsequent numbers must obey knight's move rule.

the lab phone has numbers arranged in following way: 1, 2, 3 in first row; 4, 5, 6 in second row; 7, 8, 9 in third row; , blank, 0, blank in fourth row.

1 2 3 4 5 6 7 8 9   0  

for example, if dialed 1, next number dial has either 6 or 8. if dialed 6, next number must 1 or 7.

professor boolean wants find out how many different phone numbers can dial under these conditions. write function called answer(x, y, z) computes number of phone numbers 1 can dial start digit x, end in digit y, , consist of z digits in total. output number string representing number in base-10.

x , y digits 0 9. z between 1 , 100, inclusive.

test cases

inputs: (int) x = 6 (int) y = 2 (int) z = 5 output: (string) "6"

inputs: (int) x = 1 (int) y = 5 (int) z = 100 output: (string) "0"

inputs: (int) x = 3 (int) y = 7 (int) z = 1 output: (string) "0"


i feel first test case wrong because after drawing out decision tree numbers find possible 61672, 67272, 67292, 67672, four. there i'm misinterpreting or missing problem?

i don't think test case wrong, statement

if dialed 6, next number must 1 or 7.

is wrong. not being able 6 0 makes problem not make sense. comment, blanks aren't valid moves, have 6 -> 0 being valid?

1 2 3   4 5 6   7 8 9     0 

obviously 6 -> 0 valid move, no blanks involved.


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -