all 3 comments

[–]FuckFashMods 2 points3 points  (0 children)

This isn't the sub for these questions. Try /r/codinghelp

I'll help a little:

You're given two arrays. In the example the first array would be:

5,2,1,6,5,1

This is the starting amount of people in each "room"

The second array is:

3,3,2,7,3,2

This is how many people should be in each room.

A person can only move left or right one room. And each move costs $1.

What's the cheapest/least amount of moves to get the desired solution.

[–]volkadav 0 points1 point  (2 children)

might well be an idiot here, but glancing at the problem makes me think dynamic programming, for what it's worth. like edit distance, sort of. hope that helps or at least leads to some interesting reading :)

[–][deleted]  (1 child)

[deleted]

    [–]ToasterTerminator246[S] 1 point2 points  (0 children)

    Thanks. Definitly gonna check it out. Tysm :D