The time complexity of traversing an n by m 2d array is O(nm). Consider we are given a range in an array, let's say it is (t,t) where 1<t<n and 1<t<m.( we want to traverse array starting (0,0) and to end at (t,t).
Is there any way to traverse the array in linear time?
How about space complexity?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…