摘要:
题目地址:https://leetcode-cn.com/problems/3sum/ 解题思路:笔者采用map判断重复,结果超时,原因是map是对数级时间复杂度,放在循环中就超时了。最佳思路是采用双指针加排序。 /**超时代码 * 原因:循环中使用map */ class Solution { p 阅读全文
posted @ 2020-07-28 18:00
CCxiao5
阅读(142)
评论(0)
推荐(0)
摘要:
题目地址:https://leetcode-cn.com/problems/longest-common-prefix 解题思路:暴力 class Solution { private: string getAns(string a,string b) { int len = min(a.size( 阅读全文
posted @ 2020-07-28 16:18
CCxiao5
阅读(88)
评论(0)
推荐(0)

浙公网安备 33010602011771号