Skip to main content

is_palindrome

Function is_palindrome 

Source
pub fn is_palindrome(s: &str) -> bool
Expand description

Satr palindrommi? (harf-raqamlardan boshqasi e’tiborga olinmaydi, registr muhim emas)

  • Time: O(n), Space: O(n).

§Misol

use rust_algorithms::other::strings::is_palindrome;

assert!(is_palindrome("kavak"));
assert!(is_palindrome("A man, a plan, a canal: Panama"));
assert!(!is_palindrome("salom"));
assert!(is_palindrome(""));