-
Notifications
You must be signed in to change notification settings - Fork 66
Closed
@wendajiang
Description
leetcode test 5
[INFO leetcode_cli::plugins::leetcode] Sending code to judge...
thread 'main' panicked at 'submit succcessfully, parse question_id to i32 failed: ParseIntError { kind: Empty }', src/cache/models.rs:318:34
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
and the 5 source file
class Solution { public: // 1. 中心扩展法 tuple<int, int, int> expandPalindrome(string &s, int left, int right) { int k = 0; while (left >= 0 && right < s.size()) { if (s[left] == s[right]) { left--; right++; k++; } else { break; } } return make_tuple(k, left, right); } string longestPalindrome(string s) { if (s.size() == 0) return s; int max_length = 1; int l = 0, r = 0; for (size_t i = 0; i < s.size(); i++) { int k_o = 0, k_e = 0; int l_o = 0, l_e = 0; int r_o = 0, r_e = 0; tie(k_e, l_e, r_e) = expandPalindrome(s, i - 1, i + 1); tie(k_o, l_o, r_o) = expandPalindrome(s, i, i + 1); if (k_e * 2 + 1 > max_length) { max_length = k_e * 2 + 1; l = l_e; r = r_e; } if (k_o * 2 > max_length) { max_length = k_o * 2; l = l_o; r = r_o; } } return s.substr(l + 1, r); } };
Metadata
Metadata
Assignees
Labels
No labels