Added new approach for solving problems with query.