Facebook Coding Interview Question #1

preview_player
Показать описание
Facebook Coding Interview Question #1

In this video, we will be solving an interview question that was asked by Facebook. We will use recursion and dynamic programming to solve this problem so if you haven't seen my recursion videos yet check them out now.

Link to my recursion videos:
Рекомендации по теме
Комментарии
Автор

Nice problem, although I haven't studied dynamic programming yet, understood the solution, keep posting amazing videos like this 👍

amazecreations
Автор

Thank you very much It was very interesting

avtandilsikharulidze
Автор

No. Not good. First of all, you solved the wrong problem, not paying attention to the requirement "contiguous". Second, there is no need for recursion. You sort the list. Divide the sum by 3 (partitionSum). Then iterate over the array, accumulating the sum until it equals partitionSum.. Then start the 2nd partition. Whatever remains after that is the third partition. O(n log (n))

lognosysllc
Автор

The problem states that the partition should be contiguous. The last example of all the partitions containing '2' shouldn't pass. As contiguous means made up of consecutive elements of the Array. 2 is not consecutive for the first partition. If this is the case, the solution may not be handling the actual problem. Please correct me if wrong.

misoren