Grokking the Coding Interview: Patterns for Coding Questions
Ask Author
Back to course home

0% completed

Vote For New Content
subarray_max = -math.inf subarray_min = math.inf for k in range(low, high+1):...

Jharol Rivera

Jun 2, 2022

subarray_max = -math.inf subarray_min = math.inf for k in range(low, high+1): subarray_max = max(subarray_max, arr[k]) subarray_min = min(subarray_min, arr[k])

is it possible to reduce this part to this?

subarray_max = max(arr[low:high+1]) subarray_min = min(arr[low:high+1])

0

0

Comments
Comments
P
Paolo Tormon3 years ago

Yes

K
k 2 years ago

Waiting for official answer.

Does it changes time and space complexity?

On this page