此题前面已经讲述了三种做法:二分、双指针、map
请参考题解:
https://www.cnblogs.com/jcwy/p/18043197
https://www.cnblogs.com/jcwy/p/18086618