It tried on their code provided in the PDF…and it fails on this test case…
±++++++++
±++++++++
±++++++++
±++++++++
±++++++++
±++++++++
++++++++++
++++++++++
++++++++++
++++++++++
DEN;BEN
And obviously it will fail…on seeing their algo they haven’t covered the case where length of word is smaller then the total empty space…because 2 words combined can fill it…but single cannot…so there will be a small change in their algo…please notify them about it…and hence the TEST CASES on hackerrank are also weak for this question…because their code passed all of those test cases…
https://ide.geeksforgeeks.org/CJtl2huipr
On this link you can see thier code…and the test case…that the output is none…but in actual these words can be fit in the space…