Grokking the Coding Interview: Patterns for Coding Questions
0% completed
Solution: Daily Temperatures
.....
.....
.....
Like the course? Get enrolled and start learning!
A
Anonymous
· 3 years ago
I ask this question to ensure I understand the solution correctly. In a scenario where array elements are in a descending order and the max is placed at the last position, we will be required to travel the array twice. The number of times we process each entry is twice. Does this mean the time complexity is 2N?
I understand that big O would be O(n), however would like to ensure I am thinking right.
Show 1 reply
A
Anonymous
· 3 years ago
it seems we are calculating difference of 2 pointers in array, so can I use 2 pointer mechanism? however array is not sorted?
Show 1 reply
A
Anonymous
· 3 years ago
Reading Progress
0%