Implement valid 1-D convolution | IBM Interview Question