Space complexity : $$O(1)$$. We only create constant number of booleans.

Approach #2 Object Oriented approach [Accepted]

Algorithm

In Approach#1, the code is hard to read and maintain, espeically if problem is changed to include more rules. We could improve it by seperating out the rules into different classes, and loop through them to validate against all the rules.