I was asked about time complexity in term of A and B


  • 1
    R

    Array length is A
    Target is integer, eg 5. Hence B = 5.

    After much discussion the interviewer said that the time complexity is (Worst case) B ^ A.

    In my opinion, how can the actual target number be part of time complexity? Does it make sense to say when target = 5, the time complexity is 5 ^ A ?
    I use backtracking. What is your option?


Log in to reply
 

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