Solutions in C++, Python, and Java Look at once
 Describe your first thoughts on how to solve this problem.  \n\n\n# Complexity\n- Time complexity: O(N)\n\n\n- Space complexity: O(1)\n\n\n# Code \n  Add your 
<!-- Describe your first thoughts on how to solve this problem. -->\n![b427e686-2e5d-469a-8e7a-db5140022a6b_1677715904.0948765.png](https://assets.leetcode.com/users/images/9bb9f5b1-fd11-4bb0-8644-4173cdf95d76_1682986023.367854.png)\n\n# Complexity\n- Time complexity: O(N)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code \n<iframe src="https://leetcode.com/playground/7XSmkm9m/shared" frameBorder="0" width="400" height="300"></iframe>
['Python', 'C++', 'Java', 'Python3']