Skip to content

Commit 97684b8

Browse files
authored
Update isPalindrome.m
1 parent e051eac commit 97684b8

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

algorithms/Strings/isPalindrome.m

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,14 @@
33

44
% Gets the length of the input word.
55
inputLength = length(inputWord);
6-
6+
77
% Number of pairs to compare.
88
lastIndex = floor( inputLength / 2);
9-
10-
% for every pair of letters in the word check if they match.
9+
y=1;
10+
% for every pair of letters in the word check if they match
1111
for i = 1 : lastIndex
1212
if inputWord(i) ~= inputWord(end + (1 - i))
1313
y = 0;
14-
else
15-
y = 1;
1614
end
1715
end
1816

0 commit comments

Comments
 (0)