Ad
  • Default User Avatar

    The task is to construct and return a regular expression pattern, that will match a binary number only if it is divisible by 7. The numbers are never passed to the function to be implemented.

    For example, if the task was to match binary numbers divisible by 2 (which is trivial), you would return: Pattern.compile("^[01]*0$"). This task is much more complex, of course.

  • Default User Avatar

    What if someone wanted to join more than 3 tables?

  • Default User Avatar

    I meant a case, when all points have the same x value, forming a straight line, paralell to y axis. In my solution I don't sort the points in the strip, but I still pass all the tests, becasue the number of points in the strip is relatively small. With all points having the same x value, all points end up in the strip, and such solution degrades to O(n^2).

  • Default User Avatar

    Test case for worst case scenario (when all points have the same x or y value) is missing.

  • Default User Avatar

    For each node, lookup in a map is performed twice: map.containsKey(current) and map.put(current, i). This can be avoided: put returns previous value associated with key, which can be used instead to check existance of the node instead of containsKey.