Auto include & extract definations
For example, the problem "2.add-two-numbers", the default codes are
/*
* @lc app=leetcode.cn id=2 lang=cpp
*
* [2] add-two-numbers
*/
// @lc code=start
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) {
}
};
// @lc code=end
After including & extracting definations, we can get
/*
* @lc app=leetcode.cn id=2 lang=cpp
*
* [2] add-two-numbers
*/
#include <bits/stdc++.h>
using namespace std;
struct ListNode {
int val;
ListNode *next;
ListNode() : val(0), next(nullptr) {}
ListNode(int x) : val(x), next(nullptr) {}
ListNode(int x, ListNode *next) : val(x), next(next) {}
};
// @lc code=start
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) {
}
};
// @lc code=end
And we can set auto included files in the settings page. In this example, it is "bits/stdc++.h".
Motivation
It can save some time for those problems.
Contribution
We can add settings and use regex to match the codes in the block comment.
Auto include & extract definations
For example, the problem "2.add-two-numbers", the default codes are
After including & extracting definations, we can get
And we can set auto included files in the settings page. In this example, it is "bits/stdc++.h".
Motivation
It can save some time for those problems.
Contribution
We can add settings and use regex to match the codes in the block comment.