Compare commits
3 Commits
Author | SHA1 | Date |
---|---|---|
lensfrex | eb20ced7d1 | 2 years ago |
lensfrex | f8f435a0b9 | 2 years ago |
lensfrex | b790144d80 | 2 years ago |
@ -1,93 +1,141 @@ |
|||||||
package net.lensfrex.oj.collector; |
package net.lensfrex.oj.collector; |
||||||
|
|
||||||
import com.google.gson.Gson; |
import com.google.gson.*; |
||||||
import com.google.gson.JsonArray; |
import net.lensfrex.oj.collector.data.QuestionDetail; |
||||||
import com.google.gson.JsonParser; |
import net.lensfrex.oj.collector.utils.IOUtil; |
||||||
import net.lensfrex.oj.collector.data.Result; |
|
||||||
import net.lensfrex.oj.collector.utils.NetworkUtil; |
import net.lensfrex.oj.collector.utils.NetworkUtil; |
||||||
import org.apache.http.client.utils.URIBuilder; |
import net.lensfrex.oj.collector.utils.Random; |
||||||
|
|
||||||
import java.io.IOException; |
import java.io.IOException; |
||||||
import java.net.URISyntaxException; |
import java.nio.charset.StandardCharsets; |
||||||
import java.util.ArrayList; |
import java.util.ArrayList; |
||||||
import java.util.Arrays; |
|
||||||
import java.util.HashMap; |
import java.util.HashMap; |
||||||
import java.util.Map; |
import java.util.Map; |
||||||
|
|
||||||
public class Collector { |
public class Collector { |
||||||
|
|
||||||
private static final String API_BASE = "https://oj.wust-acm.top/api/problem"; |
private static final String API_BASE = "https://leetcode.cn/graphql/"; |
||||||
|
|
||||||
private static final int PAGE_LIMIT = 100; |
private static final String DETAILS_REQUEST_BODY = IOUtil.inputStreamToString(Record.class.getResourceAsStream("/details_request_body.txt"), StandardCharsets.UTF_8); |
||||||
|
|
||||||
private String generatePageRequestUrl(String baseUrl, int offset, int limit, int page) throws URISyntaxException { |
|
||||||
URIBuilder uriBuilder = new URIBuilder(baseUrl); |
|
||||||
uriBuilder.addParameter("paging", "true"); |
|
||||||
uriBuilder.addParameter("offset", String.valueOf(offset)); |
|
||||||
uriBuilder.addParameter("limit", String.valueOf(limit)); |
|
||||||
uriBuilder.addParameter("page", String.valueOf(page)); |
|
||||||
|
|
||||||
return uriBuilder.toString(); |
|
||||||
} |
|
||||||
|
|
||||||
private HashMap<String, String> getHeaders() { |
|
||||||
HashMap<String, String> headers = new HashMap<>(); |
|
||||||
|
|
||||||
headers.put("User-Agent", "lensfrex/0.0.1 CanYouSeeMe/0.0.2 IJustLearning/0.0.3"); |
|
||||||
headers.put("Host", "oj.wust-acm.top"); |
|
||||||
headers.put("Accept-Encoding", "gzip, deflate, br"); |
|
||||||
|
|
||||||
return headers; |
|
||||||
} |
|
||||||
|
|
||||||
private Result[] getResults(String url, Map<String, String> headers) throws IOException { |
private static final String INDEX_REQUEST_BODY = IOUtil.inputStreamToString(Record.class.getResourceAsStream("/index_request_body.txt"), StandardCharsets.UTF_8); |
||||||
String json = NetworkUtil.get(url, headers); |
|
||||||
|
|
||||||
JsonArray resultJsonArray = JsonParser.parseString(json).getAsJsonObject() |
// leetcode每次最大只能获取100条。就算设置1000每次也只能获取到100条
|
||||||
.getAsJsonObject("data") |
private static final int PAGE_LIMIT = 100; |
||||||
.getAsJsonArray("results"); |
|
||||||
|
|
||||||
return new Gson().fromJson(resultJsonArray, Result[].class); |
|
||||||
} |
|
||||||
|
|
||||||
public ArrayList<Result> collectAllResults() { |
public ArrayList<QuestionDetail> collectAllQuestion() { |
||||||
ArrayList<Result> results = new ArrayList<>(); |
ArrayList<QuestionDetail> QuestionDetails = new ArrayList<>(); |
||||||
try { |
try { |
||||||
String url = generatePageRequestUrl(API_BASE, 0, 1, 1); |
// 先拿一条记录看看有多少题目
|
||||||
HashMap<String, String> headers = getHeaders(); |
String json = NetworkUtil.post(API_BASE, String.format(INDEX_REQUEST_BODY, 0, 1), headers); |
||||||
|
|
||||||
String json = NetworkUtil.get(url, headers); |
|
||||||
|
|
||||||
int totalResult = JsonParser.parseString(json).getAsJsonObject() |
int totalResult = JsonParser.parseString(json).getAsJsonObject() |
||||||
.getAsJsonObject("data") |
.getAsJsonObject("data") |
||||||
|
.getAsJsonObject("problemsetQuestionList") |
||||||
.getAsJsonPrimitive("total").getAsInt(); |
.getAsJsonPrimitive("total").getAsInt(); |
||||||
|
|
||||||
int page = (totalResult / PAGE_LIMIT) + (totalResult % PAGE_LIMIT == 0 ? 0 : 1); |
int page = (totalResult / PAGE_LIMIT) + (totalResult % PAGE_LIMIT == 0 ? 0 : 1); |
||||||
|
|
||||||
|
|
||||||
System.out.println("Total results: " + totalResult); |
System.out.println("Total results: " + totalResult); |
||||||
System.out.println("Page Limit: " + PAGE_LIMIT); |
System.out.println("Page Limit: " + PAGE_LIMIT); |
||||||
System.out.println("Total pages: " + page); |
System.out.println("Total pages: " + page); |
||||||
|
|
||||||
for (int i = 1; i <= page; i++) { |
// Fetch all question list
|
||||||
int offset = (i - 1) * PAGE_LIMIT; |
ArrayList<String> questionNames = this.fetchQuestionList(page); |
||||||
System.out.println("\n------------------------------------------------------"); |
|
||||||
System.out.println("Getting page " + i); |
|
||||||
System.out.println("Offset " + offset); |
|
||||||
|
|
||||||
url = generatePageRequestUrl(API_BASE, offset, PAGE_LIMIT, i); |
System.out.println("Total result: " + questionNames.size()); |
||||||
System.out.println("Request URL: " + url); |
|
||||||
|
|
||||||
Result[] results1 = getResults(url, headers); |
// Fetch all question details
|
||||||
|
|
||||||
results.addAll(Arrays.asList(results1)); |
for (String questionTitleSlug : questionNames) { |
||||||
|
QuestionDetail detail = fetchQuestionDetail(questionTitleSlug); |
||||||
|
|
||||||
System.out.println("Successful get " + results1.length + " result(s)"); |
record.writeToFile( |
||||||
|
"D:\\ojs-leetcode", |
||||||
|
String.valueOf(detail.getId()), |
||||||
|
detail.getChineseTitle() == null ? detail.getTitle() : detail.getChineseTitle(), |
||||||
|
record.fillText(detail)); |
||||||
|
|
||||||
|
Thread.sleep(random.getRandomNumber(256)); |
||||||
} |
} |
||||||
} catch (URISyntaxException | IOException e) { |
|
||||||
|
} catch (IOException | InterruptedException e) { |
||||||
throw new RuntimeException(e); |
throw new RuntimeException(e); |
||||||
} |
} |
||||||
|
|
||||||
return results; |
System.out.println("Finish."); |
||||||
|
|
||||||
|
return QuestionDetails; |
||||||
|
} |
||||||
|
//
|
||||||
|
// private String generatePageRequestUrl(String baseUrl, int offset, int limit, int page) throws URISyntaxException {
|
||||||
|
// URIBuilder uriBuilder = new URIBuilder(baseUrl);
|
||||||
|
// uriBuilder.addParameter("paging", "true");
|
||||||
|
// uriBuilder.addParameter("offset", String.valueOf(offset));
|
||||||
|
// uriBuilder.addParameter("limit", String.valueOf(limit));
|
||||||
|
// uriBuilder.addParameter("page", String.valueOf(page));
|
||||||
|
//
|
||||||
|
// return uriBuilder.toString();
|
||||||
|
// }
|
||||||
|
|
||||||
|
private final Record record = new Record(); |
||||||
|
private static final Random random = new Random(); |
||||||
|
|
||||||
|
private static HashMap<String, String> setHeaders() { |
||||||
|
HashMap<String, String> headers = new HashMap<>(); |
||||||
|
|
||||||
|
headers.put("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.66 Safari/537.36 Edg/103.0.1264.44"); |
||||||
|
headers.put("Host", "leetcode.cn"); |
||||||
|
headers.put("Origin", "https://leetcode.cn"); |
||||||
|
headers.put("Accept-Encoding", "gzip, deflate, br"); |
||||||
|
headers.put("Content-Type", "application/json"); |
||||||
|
|
||||||
|
return headers; |
||||||
|
} |
||||||
|
|
||||||
|
private static final Map<String, String> headers = setHeaders(); |
||||||
|
|
||||||
|
// 起始位置
|
||||||
|
private static final int START_AT = 0; |
||||||
|
|
||||||
|
private ArrayList<String> fetchQuestionList(int page) throws IOException { |
||||||
|
ArrayList<String> questions = new ArrayList<>(page * PAGE_LIMIT); |
||||||
|
String json = ""; |
||||||
|
for (int i = 1; i <= page; i++) { |
||||||
|
int offset = (i - 1) * PAGE_LIMIT; |
||||||
|
System.out.println("\n------------------------------------------------------"); |
||||||
|
System.out.println("Getting page " + i); |
||||||
|
System.out.println("Offset " + offset); |
||||||
|
|
||||||
|
json = NetworkUtil.post(API_BASE, String.format(INDEX_REQUEST_BODY, START_AT + offset, PAGE_LIMIT), headers); |
||||||
|
|
||||||
|
JsonArray questionJsonArray = |
||||||
|
JsonParser.parseString(json).getAsJsonObject() |
||||||
|
.getAsJsonObject("data") |
||||||
|
.getAsJsonObject("problemsetQuestionList") |
||||||
|
.getAsJsonArray("questions"); |
||||||
|
|
||||||
|
for (JsonElement jsonElement : questionJsonArray) { |
||||||
|
questions.add(jsonElement.getAsJsonObject().get("titleSlug").getAsString()); |
||||||
|
} |
||||||
|
|
||||||
|
System.out.println("Got result " + questionJsonArray.size()); |
||||||
|
} |
||||||
|
|
||||||
|
return questions; |
||||||
|
} |
||||||
|
|
||||||
|
private QuestionDetail fetchQuestionDetail(String name) throws IOException { |
||||||
|
System.out.println("\n------------------------------------------------------"); |
||||||
|
System.out.println("Getting question: " + name); |
||||||
|
|
||||||
|
String json = NetworkUtil.post(API_BASE, String.format(DETAILS_REQUEST_BODY, name), headers); |
||||||
|
|
||||||
|
JsonObject question = |
||||||
|
JsonParser.parseString(json).getAsJsonObject() |
||||||
|
.getAsJsonObject("data") |
||||||
|
.getAsJsonObject("question"); |
||||||
|
|
||||||
|
return new Gson().fromJson(question, QuestionDetail.class); |
||||||
} |
} |
||||||
} |
} |
@ -0,0 +1,114 @@ |
|||||||
|
|
||||||
|
package net.lensfrex.oj.collector.data; |
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@SuppressWarnings("unused") |
||||||
|
public class QuestionDetail { |
||||||
|
@SerializedName("questionFrontendId") |
||||||
|
private String id; |
||||||
|
|
||||||
|
private String title; |
||||||
|
@SerializedName("translatedTitle") |
||||||
|
private String chineseTitle; |
||||||
|
|
||||||
|
private String content; |
||||||
|
@SerializedName("translatedContent") |
||||||
|
private String chineseContent; |
||||||
|
|
||||||
|
private String difficulty; |
||||||
|
private List<String> hints; |
||||||
|
|
||||||
|
@SerializedName("topicTags") |
||||||
|
private List<Tag> tags; |
||||||
|
|
||||||
|
private boolean isPaidOnly; |
||||||
|
|
||||||
|
public boolean isPaidOnly() { |
||||||
|
return isPaidOnly; |
||||||
|
} |
||||||
|
|
||||||
|
public void setPaidOnly(boolean paidOnly) { |
||||||
|
isPaidOnly = paidOnly; |
||||||
|
} |
||||||
|
|
||||||
|
public String getId() { |
||||||
|
return id; |
||||||
|
} |
||||||
|
|
||||||
|
public void setId(String id) { |
||||||
|
this.id = id; |
||||||
|
} |
||||||
|
|
||||||
|
public String getTitle() { |
||||||
|
return title; |
||||||
|
} |
||||||
|
|
||||||
|
public void setTitle(String title) { |
||||||
|
this.title = title; |
||||||
|
} |
||||||
|
|
||||||
|
public String getChineseTitle() { |
||||||
|
return chineseTitle; |
||||||
|
} |
||||||
|
|
||||||
|
public void setChineseTitle(String chineseTitle) { |
||||||
|
this.chineseTitle = chineseTitle; |
||||||
|
} |
||||||
|
|
||||||
|
public String getContent() { |
||||||
|
return content; |
||||||
|
} |
||||||
|
|
||||||
|
public void setContent(String content) { |
||||||
|
this.content = content; |
||||||
|
} |
||||||
|
|
||||||
|
public String getChineseContent() { |
||||||
|
return chineseContent; |
||||||
|
} |
||||||
|
|
||||||
|
public void setChineseContent(String chineseContent) { |
||||||
|
this.chineseContent = chineseContent; |
||||||
|
} |
||||||
|
|
||||||
|
public String getDifficulty() { |
||||||
|
return difficulty; |
||||||
|
} |
||||||
|
|
||||||
|
public void setDifficulty(String difficulty) { |
||||||
|
this.difficulty = difficulty; |
||||||
|
} |
||||||
|
|
||||||
|
public List<String> getHints() { |
||||||
|
return hints; |
||||||
|
} |
||||||
|
|
||||||
|
public void setHints(List<String> hints) { |
||||||
|
this.hints = hints; |
||||||
|
} |
||||||
|
|
||||||
|
public List<Tag> getTags() { |
||||||
|
return tags; |
||||||
|
} |
||||||
|
|
||||||
|
public void setTags(List<Tag> tags) { |
||||||
|
this.tags = tags; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String toString() { |
||||||
|
String sb = "QuestionDetail{" + "id=" + id + |
||||||
|
", title='" + title + '\'' + |
||||||
|
", chineseTitle='" + chineseTitle + '\'' + |
||||||
|
", content='" + content + '\'' + |
||||||
|
", chineseContent='" + chineseContent + '\'' + |
||||||
|
", difficulty='" + difficulty + '\'' + |
||||||
|
", hints=" + hints + |
||||||
|
", tags=" + tags + |
||||||
|
'}'; |
||||||
|
return sb; |
||||||
|
} |
||||||
|
} |
@ -1,154 +0,0 @@ |
|||||||
|
|
||||||
package net.lensfrex.oj.collector.data; |
|
||||||
|
|
||||||
import java.util.List; |
|
||||||
import javax.annotation.Generated; |
|
||||||
|
|
||||||
import com.google.gson.annotations.Expose; |
|
||||||
import com.google.gson.annotations.SerializedName; |
|
||||||
|
|
||||||
@Generated("net.hexar.json2pojo") |
|
||||||
@SuppressWarnings("unused") |
|
||||||
public class Result { |
|
||||||
@SerializedName("_id") |
|
||||||
private String id; |
|
||||||
@Expose |
|
||||||
private String title; |
|
||||||
@Expose |
|
||||||
private Object contest; |
|
||||||
@Expose |
|
||||||
private String description; |
|
||||||
@SerializedName("input_description") |
|
||||||
private String inputDescription; |
|
||||||
@SerializedName("output_description") |
|
||||||
private String outputDescription; |
|
||||||
@Expose |
|
||||||
private String difficulty; |
|
||||||
@Expose |
|
||||||
private String hint; |
|
||||||
@SerializedName("memory_limit") |
|
||||||
private Long memoryLimit; |
|
||||||
@SerializedName("time_limit") |
|
||||||
private Long timeLimit; |
|
||||||
@Expose |
|
||||||
private List<Sample> samples; |
|
||||||
@Expose |
|
||||||
private List<String> tags; |
|
||||||
|
|
||||||
public String getId() { |
|
||||||
return id; |
|
||||||
} |
|
||||||
|
|
||||||
public void setId(String id) { |
|
||||||
this.id = id; |
|
||||||
} |
|
||||||
|
|
||||||
public String getTitle() { |
|
||||||
return title; |
|
||||||
} |
|
||||||
|
|
||||||
public void setTitle(String title) { |
|
||||||
this.title = title; |
|
||||||
} |
|
||||||
|
|
||||||
public Object getContest() { |
|
||||||
return contest; |
|
||||||
} |
|
||||||
|
|
||||||
public void setContest(Object contest) { |
|
||||||
this.contest = contest; |
|
||||||
} |
|
||||||
|
|
||||||
public String getDescription() { |
|
||||||
return description; |
|
||||||
} |
|
||||||
|
|
||||||
public void setDescription(String description) { |
|
||||||
this.description = description; |
|
||||||
} |
|
||||||
|
|
||||||
public String getDifficulty() { |
|
||||||
return difficulty; |
|
||||||
} |
|
||||||
|
|
||||||
public void setDifficulty(String difficulty) { |
|
||||||
this.difficulty = difficulty; |
|
||||||
} |
|
||||||
|
|
||||||
public String getHint() { |
|
||||||
return hint; |
|
||||||
} |
|
||||||
|
|
||||||
public void setHint(String hint) { |
|
||||||
this.hint = hint; |
|
||||||
} |
|
||||||
|
|
||||||
public Long getMemoryLimit() { |
|
||||||
return memoryLimit; |
|
||||||
} |
|
||||||
|
|
||||||
public void setMemoryLimit(Long memoryLimit) { |
|
||||||
this.memoryLimit = memoryLimit; |
|
||||||
} |
|
||||||
|
|
||||||
public Long getTimeLimit() { |
|
||||||
return timeLimit; |
|
||||||
} |
|
||||||
|
|
||||||
public void setTimeLimit(Long timeLimit) { |
|
||||||
this.timeLimit = timeLimit; |
|
||||||
} |
|
||||||
|
|
||||||
public String getInputDescription() { |
|
||||||
return inputDescription; |
|
||||||
} |
|
||||||
|
|
||||||
public void setInputDescription(String inputDescription) { |
|
||||||
this.inputDescription = inputDescription; |
|
||||||
} |
|
||||||
|
|
||||||
public String getOutputDescription() { |
|
||||||
return outputDescription; |
|
||||||
} |
|
||||||
|
|
||||||
public void setOutputDescription(String outputDescription) { |
|
||||||
this.outputDescription = outputDescription; |
|
||||||
} |
|
||||||
|
|
||||||
public List<Sample> getSamples() { |
|
||||||
return samples; |
|
||||||
} |
|
||||||
|
|
||||||
public void setSamples(List<Sample> samples) { |
|
||||||
this.samples = samples; |
|
||||||
} |
|
||||||
|
|
||||||
public List<String> getTags() { |
|
||||||
return tags; |
|
||||||
} |
|
||||||
|
|
||||||
public void setTags(List<String> tags) { |
|
||||||
this.tags = tags; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
public String toString() { |
|
||||||
final StringBuffer sb = new StringBuffer("Result{"); |
|
||||||
sb.append("id='").append(id).append('\''); |
|
||||||
sb.append(", title='").append(title).append('\''); |
|
||||||
sb.append(", contest=").append(contest); |
|
||||||
sb.append(", description='").append(description).append('\''); |
|
||||||
sb.append(", difficulty='").append(difficulty).append('\''); |
|
||||||
sb.append(", hint='").append(hint).append('\''); |
|
||||||
sb.append(", memoryLimit=").append(memoryLimit); |
|
||||||
sb.append(", timeLimit=").append(timeLimit); |
|
||||||
sb.append(", inputDescription='").append(inputDescription).append('\''); |
|
||||||
sb.append(", outputDescription='").append(outputDescription).append('\''); |
|
||||||
sb.append(", samples=").append(samples); |
|
||||||
sb.append(", tags=").append(tags); |
|
||||||
sb.append('}'); |
|
||||||
return sb.toString(); |
|
||||||
} |
|
||||||
} |
|
@ -1,32 +0,0 @@ |
|||||||
|
|
||||||
package net.lensfrex.oj.collector.data; |
|
||||||
|
|
||||||
import javax.annotation.Generated; |
|
||||||
import com.google.gson.annotations.Expose; |
|
||||||
|
|
||||||
@Generated("net.hexar.json2pojo") |
|
||||||
@SuppressWarnings("unused") |
|
||||||
public class Sample { |
|
||||||
|
|
||||||
@Expose |
|
||||||
private String input; |
|
||||||
@Expose |
|
||||||
private String output; |
|
||||||
|
|
||||||
public String getInput() { |
|
||||||
return input; |
|
||||||
} |
|
||||||
|
|
||||||
public void setInput(String input) { |
|
||||||
this.input = input; |
|
||||||
} |
|
||||||
|
|
||||||
public String getOutput() { |
|
||||||
return output; |
|
||||||
} |
|
||||||
|
|
||||||
public void setOutput(String output) { |
|
||||||
this.output = output; |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -0,0 +1,26 @@ |
|||||||
|
package net.lensfrex.oj.collector.data; |
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName; |
||||||
|
|
||||||
|
public class Tag { |
||||||
|
private String name; |
||||||
|
|
||||||
|
@SerializedName("translatedName") |
||||||
|
private String chineseName; |
||||||
|
|
||||||
|
public String getName() { |
||||||
|
return name; |
||||||
|
} |
||||||
|
|
||||||
|
public void setName(String name) { |
||||||
|
this.name = name; |
||||||
|
} |
||||||
|
|
||||||
|
public String getChineseName() { |
||||||
|
return chineseName; |
||||||
|
} |
||||||
|
|
||||||
|
public void setChineseName(String chineseName) { |
||||||
|
this.chineseName = chineseName; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1 @@ |
|||||||
|
{"operationName":"questionData","variables":{"titleSlug":"%s"},"query":"query questionData($titleSlug: String!) { question(titleSlug: $titleSlug) { questionId questionFrontendId categoryTitle boundTopicId title titleSlug content translatedTitle translatedContent isPaidOnly difficulty likes dislikes isLiked similarQuestions contributors { username profileUrl avatarUrl __typename } langToValidPlayground topicTags { name slug translatedName __typename } companyTagStats codeSnippets { lang langSlug code __typename } stats hints solution { id canSeeDetail __typename } status sampleTestCase metaData judgerAvailable judgeType mysqlSchemas enableRunCode envInfo book { id bookName pressName source shortDescription fullDescription bookImgUrl pressImgUrl productUrl __typename } isSubscribed isDailyQuestion dailyRecordStatus editorType ugcQuestionId style exampleTestcases jsonExampleTestcases __typename }}"} |
@ -0,0 +1 @@ |
|||||||
|
{"query":" query problemsetQuestionList($categorySlug: String, $limit: Int, $skip: Int, $filters: QuestionListFilterInput) { problemsetQuestionList( categorySlug: $categorySlug limit: $limit skip: $skip filters: $filters ) { hasMore total questions { acRate difficulty freqBar frontendQuestionId isFavor paidOnly solutionNum status title titleCn titleSlug topicTags { name nameTranslated id slug } extra { hasVideoSolution topCompanyTags { imgUrl slug numSubscribed } } } }} ","variables":{"categorySlug":"","skip":%d,"limit":%d,"filters":{}}} |
@ -0,0 +1,8 @@ |
|||||||
|
{ |
||||||
|
"operationName": "questionData", |
||||||
|
"variables": { |
||||||
|
"titleSlug": "two-sum" |
||||||
|
}, |
||||||
|
"query": "query questionData($titleSlug: String!) {\n question(titleSlug: $titleSlug) {\n questionId\n questionFrontendId\n categoryTitle\n boundTopicId\n title\n titleSlug\n content\n translatedTitle\n translatedContent\n isPaidOnly\n difficulty\n likes\n dislikes\n isLiked\n similarQuestions\n contributors {\n username\n profileUrl\n avatarUrl\n __typename\n }\n langToValidPlayground\n topicTags {\n name\n slug\n translatedName\n __typename\n }\n companyTagStats\n codeSnippets {\n lang\n langSlug\n code\n __typename\n }\n stats\n hints\n solution {\n id\n canSeeDetail\n __typename\n }\n status\n sampleTestCase\n metaData\n judgerAvailable\n judgeType\n mysqlSchemas\n enableRunCode\n envInfo\n book {\n id\n bookName\n pressName\n source\n shortDescription\n fullDescription\n bookImgUrl\n pressImgUrl\n productUrl\n __typename\n }\n isSubscribed\n isDailyQuestion\n dailyRecordStatus\n editorType\n ugcQuestionId\n style\n exampleTestcases\n jsonExampleTestcases\n __typename\n }\n}\n" |
||||||
|
} |
||||||
|
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,63 @@ |
|||||||
|
{ |
||||||
|
"data": { |
||||||
|
"problemsetQuestionList": { |
||||||
|
"__typename": "QuestionListNode", |
||||||
|
"questions": [ |
||||||
|
{ |
||||||
|
"__typename": "QuestionLightNode", |
||||||
|
"acRate": 0.5265447404489151, |
||||||
|
"difficulty": "EASY", |
||||||
|
"freqBar": 0, |
||||||
|
"paidOnly": false, |
||||||
|
"status": "NOT_STARTED", |
||||||
|
"frontendQuestionId": "1", |
||||||
|
"isFavor": false, |
||||||
|
"solutionNum": 18322, |
||||||
|
"title": "Two Sum", |
||||||
|
"titleCn": "两数之和", |
||||||
|
"titleSlug": "two-sum", |
||||||
|
"topicTags": [ |
||||||
|
{ |
||||||
|
"id": "wg0rh", |
||||||
|
"name": "Array", |
||||||
|
"slug": "array", |
||||||
|
"nameTranslated": "数组", |
||||||
|
"__typename": "CommonTagNode" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"id": "wzve3", |
||||||
|
"name": "Hash Table", |
||||||
|
"slug": "hash-table", |
||||||
|
"nameTranslated": "哈希表", |
||||||
|
"__typename": "CommonTagNode" |
||||||
|
} |
||||||
|
], |
||||||
|
"extra": { |
||||||
|
"companyTagNum": 394, |
||||||
|
"hasVideoSolution": true, |
||||||
|
"topCompanyTags": [ |
||||||
|
{ |
||||||
|
"imgUrl": "https://pic.leetcode-cn.com/5352d58e4b296e0704f20cfd99ecaec7af71d079b015923c72928650312c55b8-Messages Image(3349252251).png", |
||||||
|
"slug": "amazon", |
||||||
|
"__typename": "CommonTagNode" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"imgUrl": "https://pic.leetcode-cn.com/45a64add888e66ff6d3c551bed948528715996937b877aaf6fdc08eae74789f5-google-logo-png-open-2000.png", |
||||||
|
"slug": "google", |
||||||
|
"__typename": "CommonTagNode" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"imgUrl": "https://pic.leetcode-cn.com/cca55ecdfb504378955a9bf4f2f33897bb84f04f9cbf84ea96321ce5d959ee13-adobe1.png", |
||||||
|
"slug": "adobe", |
||||||
|
"__typename": "CommonTagNode" |
||||||
|
} |
||||||
|
], |
||||||
|
"__typename": "QuestionExtraInfoNode" |
||||||
|
} |
||||||
|
} |
||||||
|
], |
||||||
|
"hasMore": true, |
||||||
|
"total": 2696 |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -1,25 +1,20 @@ |
|||||||
# {{title}} |
# {{englishTitle}} | {{title}} |
||||||
|
|
||||||
-------------------------------- |
-------------------------------- |
||||||
## 题目: |
## 题目 (English & 中文): |
||||||
|
|
||||||
{{description}} |
{{englishContent}} |
||||||
|
|
||||||
## 输入: |
--- |
||||||
> {{inputDescription}} |
|
||||||
|
|
||||||
## 输出: |
{{content}} |
||||||
> {{outputDescription}} |
|
||||||
|
|
||||||
-------------------------------- |
-------------------------------- |
||||||
## 提示:{{hint}} |
## 提示: |
||||||
|
|
||||||
{{examples}} |
{{hints}} |
||||||
|
|
||||||
-------------------------------- |
-------------------------------- |
||||||
- 时间限制:{{timeLimit}} |
- 难度:{{level}} |
||||||
- 内存限制:{{memoryLimit}} |
|
||||||
|
|
||||||
- 等级:{{level}} |
|
||||||
- id:{{id}} |
- id:{{id}} |
||||||
- 标签:{{tags}} |
- 标签:{{tags}} |
||||||
|
Loading…
Reference in new issue