优化BFS解决方案

时间:2020-01-03 04:36:16

标签: python-3.x time-complexity breadth-first-search

我正在黑客世界解决这个问题: https://www.hackerearth.com/practice/algorithms/graphs/depth-first-search/practice-problems/algorithm/just-c3-has-ended-1/description/。 显然,这似乎是一个BFS问题。我解决了一些测试用例,但由于时间复杂性问题而坚持使用其他测试用例。这是我到目前为止所做的:

bar.com

谁能指出一种优化或更好的方法?

0 个答案:

没有答案