`
chriszeng87
  • 浏览: 741471 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

[leetcode] A Distance Maximizing Problem的疑问

阅读更多

http://leetcode.com/2011/05/a-distance-maximizing-problem.html

 

问题: Given an array A of integers, find the maximum of j-i subjected to the constraint of A[i] < A[j].

 

解法二:排序后的lookup table是用来做什么的,怎么构造的?

 

解法三:Generally, we want to choose only starting points with no such lines that are shorter to its left side. From the diagram above, only lines of index 0, 1, 3, 4 are valid starting points.  这一步是怎么在O(n)的时间内做到的?

 

 

0
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics