由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 开始刷leetcode,第一道题一直有run time error
相关主题
4sum的那道题请问下leetcode的two sum题目
好象是google的高频题目刷leetcode,需要提交的code runtime beat 50%+以上的submission么?
leetcode的run time errorleetcode pow runtime error??
leetcode 的two sumleetcode Parlindrome Partition run time error
sleetcode中的online judge都报runtime error, 用本地编译器执行一些例子都okleetcode彻底挂了么
Leetcode上Two sum只能过3个case, VS能过,大牛进来看看是怎么回事LeetCode Jump Game [Runtime Error]
leetcode很有意思啊Leetcode Copy List with Random Pointer Runtime Error?
Leetcode Two Sum,我这个O(n)解法为啥不讨服务器的好呢LeetCode RunTime Error一问
相关话题的讨论汇总
话题: int话题: numbers话题: error话题: twosum话题: return
进入JobHunting版参与讨论
1 (共1页)
l*********e
发帖数: 261
1
错误内容是【3,2,4】6不能通过。 可是函数twosum(int numbers[], int n, int
target)明明是三个输入,test case却是两个输入。
恳请知道的人告诉我错在哪里
谢谢
C********e
发帖数: 492
2
two sum 从来都是两个输入。

【在 l*********e 的大作中提到】
: 错误内容是【3,2,4】6不能通过。 可是函数twosum(int numbers[], int n, int
: target)明明是三个输入,test case却是两个输入。
: 恳请知道的人告诉我错在哪里
: 谢谢

l*********e
发帖数: 261
3
哪两个输入?我用C语言。谢谢!

【在 C********e 的大作中提到】
: two sum 从来都是两个输入。
l*********e
发帖数: 261
4
自己顶一下。
i*****h
发帖数: 1534
5
run time error一般就那几个原因,但我不懂C,帮顶一下。
你把代码贴上来让懂的人给你看看。
l*********e
发帖数: 261
6
n^2 solution:
int twoSum(int numbers[], int n, int target)
{
int i,j;
if(n<2) return 1;
for(i=0;i {
for(j=i+1;j {
if(numbers[i] + numbers[j] == target)
{
printf("index1=%d, index2=%d", i+1, j+1);
return 0;
}
}
}
return 1;
}
Submission Result: Runtime Error
Last executed input: [3,2,4], 6
谢谢

【在 i*****h 的大作中提到】
: run time error一般就那几个原因,但我不懂C,帮顶一下。
: 你把代码贴上来让懂的人给你看看。

1 (共1页)
进入JobHunting版参与讨论
相关主题
LeetCode RunTime Error一问sleetcode中的online judge都报runtime error, 用本地编译器执行一些例子都ok
Google Phone InterviewLeetcode上Two sum只能过3个case, VS能过,大牛进来看看是怎么回事
Microsoft screening programming problemleetcode很有意思啊
做一下common prefix in sorted string arraysLeetcode Two Sum,我这个O(n)解法为啥不讨服务器的好呢
4sum的那道题请问下leetcode的two sum题目
好象是google的高频题目刷leetcode,需要提交的code runtime beat 50%+以上的submission么?
leetcode的run time errorleetcode pow runtime error??
leetcode 的two sumleetcode Parlindrome Partition run time error
相关话题的讨论汇总
话题: int话题: numbers话题: error话题: twosum话题: return