由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - leetcode很有意思啊
相关主题
3sum on LeetCode OJ求助各位大牛:LeetCode的Decode Ways
twoSumleetcode上的populate next node I and II
Leetcode上Two sum只能过3个case, VS能过,大牛进来看看是怎么回事leetcode 一道题 valid palindrome
Leetcode Two Sum,我这个O(n)解法为啥不讨服务器的好呢Best Time to Buy and Sell Stock II这么简单?
请问下leetcode的two sum题目leetcode 3sum
开始刷leetcode,第一道题一直有run time errorleetcode我这2个palindrome的为什么过不了大oj
这段代码在leetcode上面跑不了??问一个reverse int的问题
关于leetcode上那个买卖股票II的问题请教下leetcode Permutations II
相关话题的讨论汇总
话题: int话题: ret话题: numbers话题: solution话题: public
进入JobHunting版参与讨论
1 (共1页)
u*********r
发帖数: 176
1
刚刚开始用,第一个题,
各种不同过
public class Solution {
public int[] twoSum(int[] numbers, int target) {
// Start typing your Java solution below
// DO NOT write main() function
int[] ret=new int[2];

for(int i=0;i {
for(int j=i+1;j {
if(numbers[i]+numbers[j]==target)
{
ret[0]=i;
ret[1]=j;
break;
}
}
}
return ret;
}
}

最后发现 output的index从1开始。。。。。满脸黑线
u*********r
发帖数: 176
2
大牛们就别拍小的了, 随便写了就看看怎么用
1 (共1页)
进入JobHunting版参与讨论
相关主题
请教下leetcode Permutations II请问下leetcode的two sum题目
leetcode里, backtracking的time complexity怎么算,比如permutations这题目开始刷leetcode,第一道题一直有run time error
leetcode 上的 two sum这段代码在leetcode上面跑不了??
不明白啊,为啥从这个版上看起来找CS都好难啊关于leetcode上那个买卖股票II的问题
3sum on LeetCode OJ求助各位大牛:LeetCode的Decode Ways
twoSumleetcode上的populate next node I and II
Leetcode上Two sum只能过3个case, VS能过,大牛进来看看是怎么回事leetcode 一道题 valid palindrome
Leetcode Two Sum,我这个O(n)解法为啥不讨服务器的好呢Best Time to Buy and Sell Stock II这么简单?
相关话题的讨论汇总
话题: int话题: ret话题: numbers话题: solution话题: public