First rectangle: Has 3 cubes in each 5 layers, and imagine it, so we have all dimension needed which is: l=3 unit w=1 unit h=5 unit. V=l×w×h V=3×1×5 V=15 cubic inches.
Second rectangular: Doing the same like that to get: l=5 unit w=1 unit h=3 unit V=15 cubic inches. As a result, there are no prism that are greater to each other, which mean that they have the same volume of 15 cubic inches. Hope it help!