Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions algorithms/Strings/isPalindrome.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@

% Gets the length of the input word.
inputLength = length(inputWord);

% Number of pairs to compare.
lastIndex = floor( inputLength / 2);

% for every pair of letters in the word check if they match.
y=1;
% for every pair of letters in the word check if they match
for i = 1 : lastIndex
if inputWord(i) ~= inputWord(end + (1 - i))
y = 0;
else
y = 1;
end
end

Expand Down