Hi,
I am getting the output and my code has been accepted but the code looks pretty pathetic.
Can you please suggest someway where I can bring it down from O(n2) to O(n).
#include <bits/stdc++.h>
using namespace std;
int main () {
int x,y;
cin>>x>>y;
int ans=0;
for(int i=x;i<=y;i++)
{
for(int j=i;j<=y;j++)
{
if((i^j)>ans)
{
ans=i^j;
}
}
}
cout<<ans;
return 0;
}