Hello,
I might help if you would follow these forum rules, as "We'll help you get started and exchange algorithm ideas, but only if you show that you're willing to put in effort as well."
So, tell me, please what you've already tried, what you can't understand or what troubles are you facing while coding this task?