fnplus / interview-techdev-guide

This repository contains curated technical interview questions by fn+geeks community
http://bit.ly/fnplusnow
MIT License
318 stars 325 forks source link

divide and conquer #634

Closed shrikantpadhy18 closed 4 years ago

shrikantpadhy18 commented 4 years ago

The Question for this solution resides in readme.md file the question demands to find out the maximum content children.

Here is The Question:

You are baby-sitting n children and have m > n cookies to divide between them. You must give each child exactly one cookie (of course, you cannot give the same cookie to two different children). Each child has a greed factor gi,1 ≤ i ≤ n which is the minimum size of a cookie that the child will be content with; and each cookie has a size sj , 1 ≤ j ≤ m. Your goal is to maximize the number of content children, i.e.., children i assigned a cookie j with gi ≤ s .

I have tried to solve the question using python through divide and conquer approach.