In this assignment, you'll design and implement one of the string manipulation functions that is commonly asked during interviews.
- Design and implement a function that checks if the input string is a palindrome. The function should return
True
if the input string is a palindrome, and returnFalse
if it is not a palindrome. - Share and explain the time and space complexities for your solution.
- At minimum, your implementation should pass the basic tests.
Note 1: A palindrome is a word, phrase or sentence that reads the same backwards as it does forwards. e.g. "madam"
Note 2: Do not use Python provided functionality for reversed()
, reverse()
, or string slicing ("string"[::-1]
). You may use len()
.
Install pytest
pip install pytest
To run all tests, navigate to the same directory as the test file and run:
pytest test_palindrome_check.py
Alternatively, to exit instantly on first error or failed test, run:
pytest -x test_palindrome_check.py
See pytest documentation for more information about pytest
.