# "Output Limit Exceeded" error of Python, do not know Why？

• ``````def longestCommonPrefix(self, strs):
strs.sort()
_re = []
for i in range(len(strs)):
if i-1 >= 0 and strs[i] == strs[i-1]:
continue
_tem = self.find2sum(strs[i+1:], 0-strs[i])
if len(_tem) > 0:
for (_a, _b) in _tem:
_re.append([strs[i], _a, _b])

return _re

def find2sum(self, strs, a):
_low = 0
_high = len(strs) - 1
_re = []

while _low < _high:
if strs[_low] + strs[_high] < a:
_low += 1
elif strs[_low] + strs[_high] > a:
_high -= 1
elif strs[_low] + strs[_high] == a:
_re.append([strs[_low], strs[_high]])
_low += 1
_high -= 1
return _re
``````

Do not know why it is "Output Limit Exceeded", I also tried the case
"input= [-1,0,1,2,-1,-4, -1, -1, -2, -3, -4]" and the result is “[[-3, 1, 2], [-2, 0, 2], [-1, -1, 2], [-1, 0, 1]]”, which is correct apparently.

I avoid the duplicated items by search from [i, end] for item num[i].
and skip item i when num[i+1] == num[i].

do not know why, does anyone could help me or give me some tips.

• Inspired from another user @ryanzhao, "I think your implementation output duplicates. That's why Output Limit Exceeded"

• Try your code with [0,0,0,0,0,0,0,0,0].

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.