HACKEREARTH seating arrangement problem

I tried this question from morning but not able to get its generalised solution.
please help,
problem link:-
https://www.hackerearth.com/practice/basic-programming/input-output/basics-of-input-output/practice-problems/algorithm/seating-arrangement-1/

Thanks

A typical Python Solutoin

1 Like

In c++ how to take range ?

Just run a for loop dude. If you are not aware of Python, just try to understand.
And btw, I have used a dictionary in Python, it will work even with arrays. U just need to understand the logic. I wrote it in Python, because it has better readability ( atleast for me).

Ok thanks,
Actually i code in c++