Sunday, August 17, 2025

PALINDROME

 #include <iostream>

#include<bits/stdc++.h>
 using namespace std;
 bool f(int i,string&s){
    if(i>=s.size()/2)return true;
   if(s[i]!=s[s.size()-i-1])return false;
   return f(i+1,s);
 }
 int main() {
 string s="msdam";
 cout<<f(0,s);
 return 0;
 }

No comments:

Post a Comment

MergeSort

  #include < iostream >   using namespace std ;   void merge ( vector < int >& n , int low , int mid , int high ){   ...