Coding Our Optimal Solution And Testing On LeetCode