|
|
вернуться в форумHow this problem should be approached Hi all ! Please don't take this the wrong way - I don't want to be offensive or anything, but I've seen many solutions here which employ a method that is, in my humble opinion, highly not recommended: creating a huge array of 100000 ints and simply generating the whole lot in O(N) time - which is both time and memory-consuming. Due to the excessively permissive limits, these solutions actually work, but I believe this isn't how a good coder should solve the problem. Instead, all I can tell you is that a solution exists that needs very little memory (no arrays) and works in O(log N) time. Re: How this problem should be approached could you please tell me as a hint?? Is it require a math solution ?? I was puzzled by this problem for a whole day. thanks in advance. |
|
|