Longest equally-spaced subsequence

前端 未结 10 1672
遥遥无期
遥遥无期 2020-12-22 19:12

I have a million integers in sorted order and I would like to find the longest subsequence where the difference between consecutive pairs is equal. For example



        
10条回答
  •  不思量自难忘°
    2020-12-22 19:54

    Greedy method
    1 .Only one sequence of decision is generated.
    2. Many number of decisions are generated. Dynamic programming 1. It does not guarantee to give an optimal solution always.
    2. It definitely gives an optimal solution.

提交回复
热议问题