A question on HackerEarth is to find the berth of the coach.
Question Link
I found the pattern & solved this. This is my approach. But I am not satisfied by my logic even though it passes all testcases.
Please tell me any alternate approach.
A question on HackerEarth is to find the berth of the coach.
Question Link
I found the pattern & solved this. This is my approach. But I am not satisfied by my logic even though it passes all testcases.
Please tell me any alternate approach.
I think this is the best approach.
@shivamjaiswal6
I tried another approach. I guess this would be satisfying
seat_number%=8;
if(seat_number==7)
cout<<"Side Lower \n";
else if(seat_number==8)
cout<<"Side Upper \n";
else if(seat_number%3==1)
cout<<"Lower \n";
else if(seat_number%3==2)
cout<<"Middle \n";
else
cout<<"Upper \n";
Sure!