Ad
  • Default User Avatar

    actually there is problem with time complexity, since in this code, you need to call count function(O(n) complexity) for every generated face

  • Custom User Avatar

    OP solved it, closing

  • Custom User Avatar

    The arrarys can improve readability, the only problem is that O(n) has a bigger constant.

  • Default User Avatar

    the problem is... python. It's too much of "battery included" (see below).

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    A delimiter is a character that separates values so that you know each one is separate from another one. A delimiter can be any character, but it is most commonly: a comma (","); a colon (":"); a space (" "); a semicolon(";") or a dash ("-").

    The split function separates value by their delimiter, you have put the delimiter as a comma even though the delimiter is a space. An example is: -1 50 -4 20 22 -7 0 10 -8 where you can see each value is split by a space. Since you put the delimiter as a comma, the split function will look for the comma character in order to separate each value, however there is none so it just gives a list of length 1.

  • Custom User Avatar

    The delimiter is a space character, not a comma - change .split(',') to .split(' ')

  • Custom User Avatar

    You are using Python 2.7.6 which makes use of integer divison where division results are floored (1/2 returns 0 instead of 0.5 because 0.5 floored is 0). You can fix this by stating it should be float divison (add a decimal point to one of the numbers - 1./2 or 1/2.) or you can change the Python version to Python3 which uses float divison by default and not integer division.