Algorithm(7) Two pointers and hash table (Part A)(By solution)

整理一下leetcode里面关于 2sum 3sum 的几个问题,后面还补充了几个two pointer的其他问题,主要是longest sub str with at most K distinct characters的一系列问题。关于 hashtable 以及 two pointer的应用,由于在实现上不像树、图那些在结构上比较复杂,大多是灵光一闪,或者是绕一两个弯就能想到的,面试也是各种常考,应该是要掌握好的一类基本问题。

继续阅读全文 »