Should I prioritize correctness or efficiency on online test? (Amazon)

New / Eng
szh

New Eng

szh
Feb 8, 2019 6 Comments

I received an invite for an Amazon online test (Codility, Dublin, AWS, SDE). Not sure what the level of these questions are (applied with 2+ yoe).

For non-trivial problems on the online test, does anyone know if I'm better off implementing a correct but possibly inefficient solution if I can't think of an efficient solution off the top of my head?

Usually, I have the (unhelpful) habit of trying to think of more efficient solutions when none exist, wasting a lot of time in the process. Want to mitigate the risk of doing this.

comments

Want to comment? LOG IN or SIGN UP
TOP 6 Comments
  • Amazon
    Kibana πŸ‘‘

    Go to company page Amazon

    Kibana πŸ‘‘
    Approach each problem like so:
    1. Write clean code. Make it readable. Make sure variables are named something useful, and spacing is consistent across the entire program. Add comments throughout the code explaining your thought process. It seems trivial, but trust me, you'll get some bonus points.

    2. Start coding whatever solution pops into your head. Writing a working solution that compiles and passes all test cases is the most important thing.

    3. Once you have a working solution, think about time and space complexity. Is this the most efficient solution? If it's not, write a comment in the code explaining your thought process. Remember, you have to show the reviewer what you're thinking, since you can't verbally tell them.

    4. Try to optimize it. If you can't, or don't have enough time, that's okay; you've already explained in a comment your thought process on what the most efficient solution is. You will only lose a point or two, and worst case scenario, you get assigned a phone screen instead of the onsite.

    Good luck!
    Feb 8, 2019 2
    • New / Eng
      szh

      New Eng

      szh
      OP
      Thanks a ton! Super detailed and helpful.
      Feb 9, 2019
    • New / Eng
      szh

      New Eng

      szh
      OP
      Also, how is standard library use judged? E.g. for a k-th largest question, using the heapq library for heapselect. LC accepts solutions even if you simply sort and pick the index, which seems obviously insufficient.
      Feb 9, 2019
  • Toyota
    JonSnoow

    Go to company page Toyota

    JonSnoow
    Would you rather your car to be slow but takes you anywhere you wanna go, or be fast but breaks down everytime in the middle of the road?
    Feb 8, 2019 1
  • New
    PcNF27

    New

    PcNF27
    Implement the brute force then go for the optimum
    Feb 8, 2019 0