Check if the digits in a non-negative integer form a palindrome.
- Design and implement a method that checks if the digits in the input positive integer forms a palindrome. The method returns true if the digits in the input form a palindrome. The method returns false otherwise.
- For example,
- 12521 and 4554 are palindromes.
- 326725 is not a palindrome.
- Share and explain the time and space complexities for your solution in the comments above the method implementation.
- If you describe the complexity in terms of n, be sure to explain what n stands for.
- If you think of multiple approaches to solve the problem, implement the solution which minimizes space complexity. Explain the other approaches, and your decision in comments above the code.
Note: Do not use Ruby provided functions.