Is it a palindrome? P50497


Statement
 

pdf   zip   main.cc   main.c   main.java   main.py

thehtml

Write a function that tells if s is a palindrome or not. Remember that a word is a palindrome if it reads the same from left to right than from right to left. In this exercise, s can be rather large; this is why it is passed by reference.

In order to compare the efficiency of your solution against the efficiency of the solution of the Judge, start checking s from its ends.

Interface

C++
bool is_palindrome(const string& s);
C
int is_palindrome(const char s[], int ssize);
Java
public static boolean isPalindrome(String s);
Python
is_palindrome(s) # returns bool
 
is_palindrome(s: str) -> bool

Observation You only need to submit the required procedure; your main program will be ignored.

Information
Author
Salvador Roura
Language
English
Translator
Carlos Molina
Original language
Catalan
Other languages
Catalan
Official solutions
C C++ Java Python
User solutions
C C++ Java Python