Compute the output size of a convolution along one dimension from the input size W, kernel size K, padding P (added on both sides) and stride S: ⌊(W+2P−K)/S⌋+1.
Implement solve(W,K,P,S).
Returns. Return an integer. A kernel larger than the padded input gives a value of 0 or less, meaning no valid position.
Example 1
Input:
solve(5, 3, 0, 1)
Output:
3
Example 2
Input:
solve(7, 3, 1, 2)
Output:
4
No results yet
Run your code to check it against the examples, or submit to run every test.