points by adas0693 8 hours ago | 0 comments
there is a related problem (inspired by an interview questions from ITA software, a part of Google now) that asks to find the smallest positive integer that cannot be expressed using a digit K (in [2,9]) N times in an expression that involves the four basic arithmetic operations and the parentheses: +, -, *, /, (, and ).
to make the problem more interesting, the list of operations can be extended to include exponentiation and concatenation.
for example, using the four basic operations for N=4, and K in [2,9], we get:
7 cannot be computed in 4 2s; 11 cannot be computed in 4 3s; 10 cannot be computed in 4 4s; 8 cannot be computed in 4 5s; 9 cannot be computed in 4 6s; 4 cannot be computed in 4 7s; 5 cannot be computed in 4 8s; 4 cannot be computed in 4 9s;
[–] genter 8 hours ago
Are you allowed to brute force it?
[–] argee 6 hours ago
That's how you do it right? It's a BFS with 4 being the max depth, and you print whatever numbers in the problem set which you didn't find.
[–] dooglius 3 hours ago
Figuring that out is presumably part of the interview (and would depend on N)
[–] catlifeonmars 6 hours ago