### BFS in Big-O of 3M steps

I'm sure this problem can be solved with DP, but I don't know how to do that. Instead, a simple BFS should do it. Intuition was telling me that it could be done in 3M steps (which is very fast), but the initial implementations were leading to TLE. The problem was that I was enqueuing items outside of the [0..1000] range, which was leading to an exponential execution time. With the modification inside the traversal piece, it did the trick. Happy Halloween you all! Code is below, cheers, ACC. Minimum Operations to Convert Number - LeetCode 2059. Minimum Operations to Convert Number Medium 126 11 Add to List Share You are given a 0-indexed integer array nums containing distinct numbers, an integer start , and an integer goal . There is an integer x that is initially set to start , and you want to perform operations on x such that it is converted to goal . You can perform the following operation repeatedly on the number x : If 0 <= x <= 1000 , then for any ind