Skip to content

Instantly share code, notes, and snippets.

@john012343210
Created November 9, 2018 12:10
Show Gist options
  • Save john012343210/5413e7e8a3c1d79a360947711005a2f1 to your computer and use it in GitHub Desktop.
Save john012343210/5413e7e8a3c1d79a360947711005a2f1 to your computer and use it in GitHub Desktop.
RUNNING TIME ANALYSIS

let the len of first array be n

it run in O(n)

create 26 letter array cost is constant, count the occuance of each letter in array1 is O(n) check whether the element in array2 is indeed in array1 is O(n)

Totally O(n)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment