Yesterday I attended the interview. He gave me some programming questions to solve. When I resolved them, the interviewer said that this can be done with better complexity over time. I was so depressed that I canโt make the program in the best time complexity. Finally, I cannot go through the interview process. But what I want to know is, how can we do at best for any problem? What should be my approach to achieving this state? I know that the ideal answer is practice . But still I want to know how and what ways to make the program so that it works in less time and uses the best memory. What books do I need to read? What problems should I practice?
PS: I know this is not a technical issue. But please let me know how I can do this.
One of the best books on algorithms, data structures, complexity of time and space. Introduction to algorithms . I can also recommend you read the following books in order to prepare well for the interview:
, " ". , B[i] = P/A[i], P - A[i], . , O (n) P ( n-1), B[i] ( n ).
B[i] = P/A[i]
P
A[i]
B[i]
" " - . , , "A[2] * A[3] ... A[n-1]", , " ".
"A[2] * A[3] ... A[n-1]"
.
- .
: