Skip to content

Improvement in time complexity of rotatedDistance problem(rotated sorted array)  #3

@Akhilj786

Description

@Akhilj786

I came across 2 problem in your approach:

  1. If you are doing it O(n) then you could do a simple scan and just minimum value and then return its index. This could have avoided your complex code.
  2. Time complexity is O(log n):
    http://stackoverflow.com/questions/2796413/binary-search-to-find-the-rotation-point-in-a-rotated-sorted-list

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions