Ad
  • Custom User Avatar

    I think your problem was with using array_unique I guess internally it makes a copy of the array and that was what's exhausting the memory.

  • Custom User Avatar

    I created a second array with unique values.
    I found a solution without creating a unique array and now they all pass. Thx for the tip.

  • Custom User Avatar

    Click reset a few times and try again. If it still doesn't work, paste your code and mark your post as having spoiler content. Are you by any chance creating a new array?

  • Custom User Avatar

    I'm still getting this error when running my solution:
    Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 67108872 bytes) in /home/codewarrior/run.php on line 6

    I only get this on the last testAdvanced so i guess my solution works but the test array must be to big.

  • Custom User Avatar

    @GlennVL91 try again now.

  • Custom User Avatar

    I think I've solved it now, reduced the length of the array (it was exhausting the available memory without reaching a timeout). I've added a test about processing time for the Advanced tests part, and if your code runs for more than 500ms it'll fail.

  • Custom User Avatar

    Yes, it seems a test array is so big that even O(n) solutions won't pass now.

  • Custom User Avatar

    Your solution is not performant enough, but the random tests are broken right now, one test won't pass even O(n) algorithms.

  • Custom User Avatar

    I have different PHP solutions for this issue but on the last test i get a memory issue because of the large test data.

    Somebody had the same problem and can help me towards the right solution?