Steps to get the solution: 1. We have take two pointer,one starting from start of the string and second one from end of string 2. Loop first pointer from 0th index to middle of the string and second pointer from end to 0th index 3. Compare value at first pointer's index with value at second pointer's index, when the values are not same , set Flag as 1, which means string is not a palindrome 4. If flag is 0 and we come out of the loop, it means string values till the middle indexe's are same, so they are palindrome. Code e.g

  function palindrome(str)
    var flag=0;
     for(var i=0,j=str.length-1;i<(str.length/2)&&j>0; i++,j--)
	 if(flag==1) {
	    console.log("string "+str+" is not a palindrome");
         } else {
            console.log("string "+str+" is a palindrome");	
  palindrome("malayalam"); //string malayalam is a palindrome
  palindrome("malaam"); //string malaam is not a palindrome

Time complexity :- As there is only one for loop ,the time complexity is O(n)