Skip to content

Conversation

@kaushik713
Copy link

No description provided.

let half_len = num.len()/2;
// here we use take() for taking a substring and eq for comparing
//here we check palindrome
if num.chars().take(half_len).eq(num.chars().rev().take(half_len))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition always yields false. Please run and test the program before creating pull request.

trim the whitespaces from num before taking half_len. Rust donot remove whitespaces by default.

use num.trim() to remove whitespaces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants