Skip to content

AdaGold/palindrome-check

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Palindrome Check

In this assignment, you'll design and implement one of the common string manipulation functions. Remember that a string is an array of characters. Algorithms that worked on array data structure will work on strings as well.

Exercise

  • Design and implement a method that checks if the input string is a palindrome. The method should return true, if the input string is a palindrome and return false, if it is not a palindrome.
    • Do not alter the input string.
    • Find a solution that optimizes the space complexity as much as possible. In other words, check if your algorithm can avoid duplicating the original string.
  • Share and explain the time and space complexities for your solution in the comments above the method.
    • If you describe the complexity in terms of n, be sure to explain what n stands for.
  • Palindrome is a word, phrase or sentence that reads the same backwards as it does forwards. e.g. "madam"
    • For this exercise purposes, white spaces are ignored while checking for a palindrome string.

Notes:

  • Do not use any Ruby provided methods available in the String class.
  • You may use .length method in the String class.
  • You may retrieve a character at a given index, or update a character at a given index using any available approach.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages