although this problem looks simple, it is very difficult. If you say you are beginner I would rather say no.
I would go for an recursive approach. However more complex recursion can only be done by script. Without the ability code and knowledge about Rhinocommon you won’t have a chance. Maybe someone is sharing a script…
If your wall is of this size, solve it manually. That’s the most practical solution here.