Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • $\begingroup$ I think this is a misunderstanding of the question (which is understandable, as I found the question is not so easy to understand). We've got an array here, and the conditions are that $A[i] \le 2 A[j]$ for all $i,j$ with $|i-j|\le k$. That's not the same as what you wrote in the first line. In other words, the indices must differ by at most $k$, and the elements at those indices must differ by at most a factor of two. This answer mixes the two up. $\endgroup$ Commented Feb 1, 2017 at 23:07
  • $\begingroup$ I also read it as "one distance cannot be exactly twice another distance" which again totally changes the algorithm. $\endgroup$ Commented Feb 2, 2017 at 0:31