We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
The problem of the last test - some optimizatins. If all tests are passed except the last (timeout) - seems like your idea is ok. In my case the problem was in L-shaping. I collected all of them inside one set and passed it through the recursion. But (F# lang) the search is Log(O). I have changed 1 common storage to 2 separaged, level1 and level2. So when i checked (i,j) place - I have chacked (except lines and diagonales) only level1 set. if it was ok - add to level2 new L-shaped positions and add 2 points to new Level3 set. the next iteration is level2 as level1 and level3 as level2. Through this way every step have 3 check in Set(N) and 1 check in Set(4). Hope it is clear....
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Super-Queens on a Chessboard
You are viewing a single comment's thread. Return to all comments →
The problem of the last test - some optimizatins. If all tests are passed except the last (timeout) - seems like your idea is ok. In my case the problem was in L-shaping. I collected all of them inside one set and passed it through the recursion. But (F# lang) the search is Log(O). I have changed 1 common storage to 2 separaged, level1 and level2. So when i checked (i,j) place - I have chacked (except lines and diagonales) only level1 set. if it was ok - add to level2 new L-shaped positions and add 2 points to new Level3 set. the next iteration is level2 as level1 and level3 as level2. Through this way every step have 3 check in Set(N) and 1 check in Set(4). Hope it is clear....