Enough talk, let’s see some action then.

I want to show you the concept with a similar problem, but it’s a little bit different. Here is the original problem if you’re interested. Also, I’ll show you solution in TypeScript. You should push yourself a bit to understand because the easy way is not the best way to learn.

Problem says:

Two children, Lily and Ron, want to share a chocolate bar. Each of the squares has an integer on it.

Lily decides to share a contiguous segment of the bar selected such that:

```
The length of the segment matches Ron's birth month, and,
The sum of the integers on the squares is equal to his birth day.
```

Determine how many ways she can divide the chocolate.

Example

s = [2, 2, 1, 3, 2]

d = 4

m = 2

Lily wants to find segments summing to Ron’s birth day, d = 4 with a length equalling his birth month, m=2. In this case, there are two segments meeting her criteria: [2, 2] and [1,3].

…

There is different way to solve this problem but lets make it similar with Chunky Monkey;

If you try to solve it with the same codes, it will be wrong again because there are tiny differences between these two problems. I believe you will find and solve it. The main aim of this ‘Chunky Monkey’ challenge is to improve problem-solving skills and to use your tools in different ways.

Happy coding!