sometimes it's better to use dynamic size arrays. java's arraylist can provide you this feature. try to solve this problem using arraylist. you are given lines. in each line there are zero or more integers. you need to answer a few queries where you need to tell the number located in position of line. take your input from system.in.