s*******y 发帖数: 105 | 1 在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... 阅读全帖 |
|