### sasanking's blog

By sasanking, 2 months ago,

This is the question I am talking about — 1948 C : Arrow Path I have written an easier solution only using if and while loop. Check this out if someone is stuck at this question

**HERE WE GO**

#include <vector>
using namespace std;

int main(){
int t;
char temp;
int take;
cin>>t;
for(int test=0;test<t;test++){
int n;
cin>>n;

string row1;
cin>>row1;
string row2;
cin>>row2;

int i=0;
int row=1;
int nmove=0;
int flag=true;
do{
if(row==1){
if(row1[i+1]=='<'){
if(row2[i]=='<'){
//cout<<i<<endl;
cout<<"NO"<<endl;
flag = false;
break;
}
row = 2;
i=i+1;
nmove++;
}
else{
i=i+2;
nmove=0;
}
}
else{
if(row2[i+1]=='<'&&i!=n-2){
if(row1[i]=='<'){
//cout<<i<<endl;
cout<<"NO"<<endl;
flag = false;
break;
}
row = 1;
i=i+1;
nmove++;
}
else{
i=i+2;
nmove=0;
}
}
if(nmove>=2){
//cout<<i<<endl;
cout<<"NO"<<endl;
flag = false;
break;
}
}while(i<=n-2);
if(flag){
cout<<"YES"<<endl;
}
}
}

• 0

 » 2 months ago, # |   0 look only if you tried hard finding mistake in you sol1 6 ><><>< ><<>>< correct :- NO your output :- YES 
•  » » 7 weeks ago, # ^ |   0 Sorry for that, I misunderstood the question. I have got it cleared and updated the blog.
 » 6 weeks ago, # |   +3 Even I did it easily.I guess our approach is similar just that you wrote a bit too much codevoid solve(){ int n; cin>>n; string s1,s2; cin>>s1>>s2; `bool check=false; for (int i = 1; i < n; i+=2) { if((s1[i]=='<'&&s2[i-1]=='<')||s1[i]=='<'&&s2[i+1]=='<'){cout<<"NO"<