This is not that difficult, if you can use T(n-1) to represent T(n)
It will be difficult to represent T(n) in terms of n with just one formula.
I don't know if you can do that or not.
If that's the only way, the interviewer should tell you that. Otherwise,
one will stuck there forever, or think it's impossible.
The expected value of the last roll is 3.5, so if you get 3, you try again;
if you get 4, you don't try.
This strategy gives u: on 1, 2, 3, on average you get 3.5, so the total
average is (3.5X3 + 4 + 5 + 6)/6 = 4.25, this is the expected value for the
last two rolls.
So if you are at the first roll, you stop if you get 5 or 6, otherwise you
continue.
This strategy gives u: on 1, 2, 3, 4, on average you get 4.25, so the total
average is (4.25X4 + 5 + 6)/6 = 4.6667.
If there are n rolls left, and you already know the average for (n-1) is T(n
-1), then you just need to represent the above idea in a mathematical form,
which might not be very straightforward, or concise.
When T(n) is above 5, you'll only stop if you get a 6.