由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 求助各位大牛:LeetCode的Decode Ways
相关主题
leetcode上 decode ways 那一题 running time errorDP的状态转移方程
I want to hear your explaination of this solution of decode ways.decode ways follow up string 里面有* 怎么修改代码?
脸书的高频题decode ways的follow up怎么解facebook面经
一刀题腐败面经
Docode 问题F电面
问个python语法FB很容易的电面跪了(自我感觉coding没问题),是怎么回事
Hackercup: Squished Status & LeetCode: Decode Waysfacebook 面经
F电面FB电面跪了,这算被黑了[转载]
相关话题的讨论汇总
话题: numarray话题: return话题: else话题: len话题: int
进入JobHunting版参与讨论
1 (共1页)
f*******w
发帖数: 1243
1
在OJ上跑总是说internal error……
自己电脑上跑所有test case都没问题。
检查不出哪里错了……求助各位大牛
程序:
class Solution {
public:
int numDecodings(string s) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
if (s.empty()) return 0;
int len = s.size();
if (len < 1) return 0;
int numarray[len];
int i = len - 1;
if (s[i] > '9' || s[i] < '0') return 0;
else {
numarray[i] = (s[i] == '0') ? 0 : 1;
i--;
}
if (i >= 0) {
if (s[i] > '9' || s[i] < '0') return 0;
if (s[i] == '0') numarray[i] = 0;
else if (s[i] == '1' || (s[i] == '2' && s[i+1] <= '6'))
numarray[i] = numarray[i+1] + 1;
else
numarray[i] = numarray[i+1];
i--;
}
while (i >= 0) {
if (s[i] > '9' || s[i] < '0') return 0;
if (s[i] == '0') numarray[i] = 0;
else if (s[i] == '1' || (s[i] == '2' && s[i+1] <= '6'))
numarray[i] = numarray[i+1] + numarray[i+2];
else
numarray[i] = numarray[i+1];
i--;
}
return numarray[0];
}
};
f*******w
发帖数: 1243
2
貌似OJ出问题了? 所有程序直接写return 0 都是Internal Error……
e******o
发帖数: 757
3
应该是出问题了。 hello world 都不成

【在 f*******w 的大作中提到】
: 貌似OJ出问题了? 所有程序直接写return 0 都是Internal Error……
1 (共1页)
进入JobHunting版参与讨论
相关主题
FB电面跪了,这算被黑了[转载]Docode 问题
被thank you的fb电面面经问个python语法
关于技能规划,发包子求指点Hackercup: Squished Status & LeetCode: Decode Ways
leetcode上的大oj和小oj有什么本质差别吗?F电面
leetcode上 decode ways 那一题 running time errorDP的状态转移方程
I want to hear your explaination of this solution of decode ways.decode ways follow up string 里面有* 怎么修改代码?
脸书的高频题decode ways的follow up怎么解facebook面经
一刀题腐败面经
相关话题的讨论汇总
话题: numarray话题: return话题: else话题: len话题: int