Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 263f260

Browse files
author
luchenqun
committed
更新cpp提交,只提交Solution类
1 parent e1fa402 commit 263f260

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,5 @@ jspm_packages
3939
tmp/
4040
*.swp
4141
.DS_Store
42-
package-lock.json
42+
package-lock.json
43+
.vscode/

lib/commands/show.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,8 @@ using namespace std;
126126
127127
int main()
128128
{
129-
Solution *s = new Solution();
129+
Solution s;
130130
131-
delete s;
132131
return 0;
133132
}
134133
`

lib/plugins/leetcode.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,14 @@ function runCode(opts, problem, cb) {
183183
typed_code: h.getFileData(problem.file)
184184
});
185185

186+
if(opts.body.lang === 'cpp') {
187+
var start = opts.body.typed_code.indexOf('class Solution');
188+
var end = opts.body.typed_code.indexOf('int main()');
189+
if(start > 0 && end > 0) {
190+
opts.body.typed_code = opts.body.typed_code.substring(start, end);
191+
}
192+
}
193+
186194
const spin = h.spin('Sending code to judge');
187195
request(opts, function(e, resp, body) {
188196
spin.stop();

0 commit comments

Comments
 (0)