Skip to content

Instantly share code, notes, and snippets.

@zeuschild
Created September 10, 2017 07:15
Show Gist options
  • Save zeuschild/c2fe70af2d92034142f82682ee3fb7aa to your computer and use it in GitHub Desktop.
Save zeuschild/c2fe70af2d92034142f82682ee3fb7aa to your computer and use it in GitHub Desktop.
Oursky Developer Pre-Test

The computational complexity of my answer in Question 1:

  1. Time complexity : O(n). I iterate the n elements vector two times. Because the look up time in map is O(1), the time complexity is O(n).
  2. Space complexity : O(n). The needed space is based on the elements number in the map, which is n.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment