Is pallindrome?(hackers block problem)

i am not able to code for the problem specified in the contest problem

https://ide.codingblocks.com/s/101772 - this is the url of the code .

please tell me how to do changes to this

@Ayushi21
There is absolutely no need for the reverse( ). You can remove it entirely.
As for the rest of the code , your algo implementation is right. Let’s just get it working according to the specified input-output format.
Take a string in input. Let’s call it ā€˜str’.
Pass str as a parameter to the isPalindrome( ) function. Make corresponding changes in the function definition as well.
Check if the string passed as parameter is a palindrome in the isPalindrome( ) .
You need to print ā€œtrueā€ or ā€œfalseā€ as output.
Simply using cout with a bool type wouldn’t work as it would print 1 for true and 0 for false by default.
Use boolalpha with it.

cout << boolalpha << isPalindrome(str) ;

This will print ā€œtrueā€ or ā€œfalseā€ instead of 1 or 0.

hey the code still is not passing two cases. can you please check it. https://ide.codingblocks.com/s/101772 - this is the url of the code

@Ayushi21
Made the required changes.
Kindly refer to this code - https://ide.codingblocks.com/s/101989

hey sir the code still is not passing the two testcases.

@Ayushi21
This is the problem link that I was trying - https://hack.codingblocks.com/contests/c/720/234
I submitted the same code mentioned above and got a full score. If you are trying some other question related to Palindromes , please share the HackerBlocks problem link.

https://hack.codingblocks.com/contests/c/917/371 - i am asking about this question

@Ayushi21
Since this question requires us to check whether the integer array or not , we should pass the array and its size as argument instead of the string and follow the same procedure as we did on the string. It would work.
Note that the problem says that you are supposed to write a recursive function for this problem and the above code does not use recursion. So I request you to try an alternate approach using recursion.
Here’s a hint
bool isPalindrome( int arr[ ] ,int i, int j)

Here arr is your integer array which you took as input.
i is your pointer variable starting from 0.
j is your pointer variable starting from the end i.e. n-1.

At each recursive call , compare arr[i] and arr[j] .
If they are not equal , return false.

If they are equal , make a recursive call on isPalindrome(a,i+1,j-1) and return whatever the recursive call returns.

Repeat this process till i<=j .
This would complete your recursive palindrome check function.

Try this out and let me know if you face any problems.

is this what you are trying to say. https://ide.codingblocks.com/s/102393 - this is the code

@Ayushi21
You have mixed up the iterative and the recursive approach.
Kindly refer to this modified code and let me know if you have any doubts regarding it.
Code - https://ide.codingblocks.com/s/102441