In interview code the solution with two tables NOT the easiest one


  • 2
    H

    I encountered this question in an interview. First, I coded the easiest answer given here
    https://discuss.leetcode.com/topic/30625/easiest-java-solution/5. I thought if that can pass OJ then it should be good enough.
    But, I was told to code the more efficient one (using tables) and it should compile and run with test cases. I managed to write the code and test case for the efficient one but the timer went off just before running the code. However, the interviewer acknowledged that later solution is the most efficient and that he was expecting that first. Hence, if you see this question then don't code the easiest solution but do the more efficient one as that is what people expect and you will also save time by not writing the easiest and less efficient code.


  • 0
    D

    FB interview?
    Also if you code write the code for your solution that would be great!


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.