check visiting cicurlar Gas Station or not in dynamic programming