Ad
  • Custom User Avatar

    I like that it's iterative, but it would be faster if you maintained a count of opens and a count of closes as variables rather than calling out to this countOpens/countCloses function which loops through n elements again.