Altimetrik interview question

Code for finding sub array whose sum is less than x