这个问题可能会被问很多次,但仍然不是所有的答案都能得到解决。因为我只剩下不到 20 小时了所以我希望有人能给我一些建议。真的很感谢你的帮助。
目前,我只剩下一个测试用例失败要处理(测试用例 3),但我不知道我忘记包括什么情况。我为我制作了一个 Matrix 和 Fraction 类,以便更轻松地进行操作。对不起,注释 println 是为了我的调试。
我使用吸收马尔可夫链的概念来找到 Q、R、F 和 FR 矩阵,这些矩阵启发了我https://github.com/ivanseed/google-foobar-help/blob/master/challenges/doomsday_fuel/doomsday_fuel.md。
如果您有任何意见,再次感谢!请帮忙!
问题和我的 Solution.java 如下:
题:
Write a function solution(m) that takes an array of array of nonnegative ints representing how many times that state has gone to the next state and return an array of ints for each terminal state giving the exact probabilities of each terminal state, represented as the numerator for each state, then the denominator for all of them …Run Code Online (Sandbox Code Playgroud)