Codes for hackerrank.com