xavier-cai / vscode-leetcode-cpp-debug

Debug support for LeetCode with C++
https://marketplace.visualstudio.com/items?itemName=XavierCai.vscode-leetcode-cpp-debug
MIT License
25 stars 5 forks source link

二维数组输入解析失败 #18

Closed sjtuwater closed 3 years ago

sjtuwater commented 3 years ago

动画

xavier-cai commented 3 years ago

整个二维数组应该被放在同一行,而不是多行,请参考力扣控制台的测试用例输入:

[["5","3",".",".","7",".",".",".","."],["6",".",".","1","9","5",".",".","."],[".","9","8",".",".",".",".","6","."],["8",".",".",".","6",".",".",".","3"],["4",".",".","8",".","3",".",".","1"],["7",".",".",".","2",".",".",".","6"],[".","6",".",".",".",".","2","8","."],[".",".",".","4","1","9",".",".","5"],[".",".",".",".","8",".",".","7","9"]]
xavier-cai commented 3 years ago

抱歉,发现另一个问题,现在并不支持char类型作为输入

xavier-cai commented 3 years ago

遇到Conversion from JSON to char not implemented问题时可以暂时在solution的code上面补如下内容:

#include "leetcode-io.h"

template <>
struct lc::conv::Convert<char> {
    static void FromJson(char& v, const json::Json& js) {
        v = js.GetObject<json::JString>()->GetString().front();
    }
    static json::Json ToJson(const char& v) {
        return json::Json::Create<json::JString>(std::string(1, v));
    }
};

对char的支持会在下一次更新时引入

sjtuwater commented 3 years ago

遇到Conversion from JSON to char not implemented问题时可以暂时在solution的code上面补如下内容:

#include "leetcode-io.h"

template <>
struct lc::conv::Convert<char> {
    static void FromJson(char& v, const json::Json& js) {
        v = js.GetObject<json::JString>()->GetString().front();
    }
    static json::Json ToJson(const char& v) {
        return json::Json::Create<json::JString>(std::string(1, v));
    }
};

对char的支持会在下一次更新时引入

牛牛牛~

xavier-cai commented 3 years ago

Issue resolved, commit: dfb6841552ab1e2a7cafeecbedf94535bbf54428