Added non-recursive solution for Lab3