hackerRanksolution

Little Priyanka visited a kids' shop. There are N toys and their weight
is represented by an array W=[w1,w2,…,wN]. Each toy costs 1 unit, and
if she buys a toy with weight w′, then she can get all other toys whose
weight lies between [w′,w′+4] (both inclusive) free of cost.