You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: 795. Number of Subarrays with Bounded Maximum.go
    path of file: ./repos/LeetCode-Go/leetcode/0795.Number-of-Subarrays-with-Bounded-Maximum
    
    the code of the file until where you have to start completion: package leetcode

func numSubarrayBoundedMax(nums []int, left int, right int) int {
	return getAnswerPerBound(nums, righ
    
func getAnswerPerBound(nums []int, bound int) int {
	res, count := 0, 0
	for _, num := range nums {
		if num <= bound {
			count++
		} else {
			count = 0
		}
		res += count
	}
	return res
}