solving some problems on www.hackerrank.com