Read the full problem at the link above. You need to count paths with length in the range . Both bounds are inclusive. The constraints are similar to Fixed-Length Paths I, so you need an solution. Brute force checking all pairs and filtering by length will not work. Think about how to adapt the previous approach.
Instead of checking , what range should be in?
Space complexity is for the data structures used.