POW straightforward(but time out) solution and improved solution