jazz 🎶

trying to find minimum insertions to balance string with omitted characters such that double letters are added like parens (i.e. not inside each other as (){[}] would be illegal, as aabcbc is)

  • going from smallest to largest ranges of
  • simplest case is duplicating , meaning
  • if can pair to some within the range, then separate parts are the inside and outside after . thus, take if pair is found
  • answer is , finding min insertions in full range

3sum

usaco.guide

finding number of triples in array that sum to zero

  • count of ways is dependent on and
  • need to not to double count, so subtract
  • those ranges exclude the triple , so need to include it
  • frame as , where is amount of triples with and