Skip to content
Open
Show file tree
Hide file tree
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
21 changes: 21 additions & 0 deletions Week1/assignments/Bright/Exercise#12.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
function palindrome(str) {

var lent = str.length;
var mid = Math.floor(lent/2); //Round lent downward to its nearest integer:

//
for ( var i = 0; i < mid; i++ ) {
if (str[i] !== str[lent - 1 - i]) {
return false;
}
}

return true;
}
// test case
console.log(palindrome("mom"));
Copy link
Member

Choose a reason for hiding this comment

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

Your algorithm will fail for a case such as Racecar






3 changes: 3 additions & 0 deletions Week1/assignments/Bright/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# About me

My name is EFUETBEJA BRIGHT TANZE. Student at COT universtity of Buea.