Since this question doesnt specify a programming language I am using c++.
This question asks if a horse can reach from one cell to another in one move.
#include<bits/stdc++.h>
using namespace std;
int main()
{
int x1,x2,y1,y2;
cin>>x1>>y1>>x2>>y2;
if(abs(x1-x2)==2&&(abs(y1-y2)==1))
cout<<"YES"<<endl;
else if(abs(x1-x2)==1&&abs(y1-y2)==2)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
Get Answers For Free
Most questions answered within 1 hours.