由买买提看人间百态

topics

全部话题 - 话题: tempj
(共0页)
s*******y
发帖数: 105
1
来自主题: JobHunting版 - SUM3这道题
在leetcode网上看到一种解法,感觉是对的,但是通不过OJ,显示Time Limit
Exceeded, 懂的童鞋给分析下code哪里有问题,3ks~
class Solution {
public:
vector > threeSum(vector &num) {
// Start typing your C/C++ solution below
// Start typing your C/C++ solution below
// DO NOT write int main() function
sort(num.begin(),num.end());
vector > r;
vector a;
int len = num.size();
if( len < 3 || num[0] > 0 || num[len-1] < 0 )
{
retu... 阅读全帖
(共0页)