代码拉取完成,页面将自动刷新
/*
* Created by hangangqiang on 2023.08.29.
*/
#ifndef LEETCODE_SOLUTION_H
#define LEETCODE_SOLUTION_H
#include <memory>
#include <map>
#include <string>
#include <utility>
#include <vector>
#include "data.h"
#include "test_case.h"
class Solution {
public:
explicit Solution(std::string name = "") : name_(std::move(name)){};
void SetName(const std::string &name) { this->name_ = name; }
std::string GetName() const { return this->name_; }
virtual std::unique_ptr<Data> Execute(std::unique_ptr<TestCase> &test_case) {
if (test_case == nullptr) {
return nullptr;
}
return Solve(*test_case->GetInput());
}
protected:
virtual std::unique_ptr<Data> Solve(Data &input) = 0;
std::string name_;
};
#define DefSolution(name) \
class Solution##name : public Solution { \
public: \
explicit Solution##name() = default; \
\
protected: \
std::unique_ptr<Data> Solve(Data &input) override; \
}
#endif // LEETCODE_SOLUTION_H
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。