leetcode

package
v0.0.0-...-e141167 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package leetcode contains some function for calling leetcode api

Index

Constants

View Source
const (
	SubmitStatusAccepted            = "通过"
	SubmitStatusWrongAnswer         = "解答错误"
	SubmitStatusMemoryLimitExceeded = "超出内存限制"
	SubmitStatusOutputLimitExceeded = "超出输出限制"
	SubmitStatusTimeLimitExceeded   = "超出时间限制"
	SubmitStatusRuntimeError        = "执行出错"
	SubmitStatusInternalError       = "内部出错"
	SubmitStatusCompileError        = "编译出错"
	SubmitStatusTimeout             = "超时"
)

Variables

View Source
var (
	SubmitStatusMap = map[string]string{
		"A_10": SubmitStatusAccepted,
		"A_11": SubmitStatusWrongAnswer,
		"A_12": SubmitStatusMemoryLimitExceeded,
		"A_13": SubmitStatusOutputLimitExceeded,
		"A_14": SubmitStatusTimeLimitExceeded,
		"A_15": SubmitStatusRuntimeError,
		"A_16": SubmitStatusInternalError,
		"A_20": SubmitStatusCompileError,
		"A_30": SubmitStatusTimeout,
	}

	SubmitLanguageMap = map[string]string{
		"A_0":  "C++",
		"A_1":  "Java",
		"A_2":  "Python",
		"A_3":  "MySQL",
		"A_4":  "C",
		"A_5":  "C#",
		"A_6":  "JavaScript",
		"A_7":  "Ruby",
		"A_8":  "Bash",
		"A_9":  "Swift",
		"A_10": "Go",
		"A_11": "Python3",
		"A_12": "Scala",
		"A_13": "Kotlin",
		"A_14": "MS SQL Server",
		"A_15": "Oracle",
		"A_16": "HTML",
		"A_17": "Python ML",
		"A_18": "Rust",
		"A_19": "PHP",
		"A_20": "TypeScript",
		"A_21": "Racket",
		"A_22": "Erlang",
		"A_23": "Elixir",
	}

	DifficultyMap = map[string]string{
		"Easy":   "简单",
		"Medium": "中等",
		"Hard":   "困难",
	}

	CompanySlugMap = map[string]string{
		"google":    "谷歌",
		"bytedance": "字节跳动",
		"amazon":    "亚马逊",
	}
)

Functions

This section is empty.

Types

type LeetClient

type LeetClient struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(endpoint string) *LeetClient

func (*LeetClient) Debug

func (c *LeetClient) Debug(debug bool)

func (*LeetClient) GetQuestionOfToday

func (c *LeetClient) GetQuestionOfToday(ctx context.Context) (questions []TodayRecord, err error)

func (*LeetClient) GetRecentSubmissions

func (c *LeetClient) GetRecentSubmissions(ctx context.Context, user string) (submissions []RecentSubmissions, err error)

type Question

type Question struct {
	QuestionFrontendID string `json:"questionFrontendId"`
	Difficulty         string `json:"difficulty"`
	Title              string `json:"title"`
	TranslatedTitle    string `json:"translatedTitle"`
	TitleSlug          string `json:"titleSlug"`
	Typename           string `json:"__typename"`
}

type QuestionOfToday

type QuestionOfToday struct {
	TodayRecord []TodayRecord `json:"todayRecord"`
}

type RecentSubmissions

type RecentSubmissions struct {
	Status     string      `json:"status"`
	Lang       string      `json:"lang"`
	Source     interface{} `json:"source"`
	Question   Question    `json:"question"`
	SubmitTime int64       `json:"submitTime"`
	Typename   string      `json:"__typename"`
}

type TodayRecord

type TodayRecord struct {
	Date       string `json:"date"`
	UserStatus string `json:"userStatus"`
	Question   struct {
		QuestionID         string      `json:"questionId"`
		FrontendQuestionID string      `json:"frontendQuestionId"`
		Difficulty         string      `json:"difficulty"`
		Title              string      `json:"title"`
		TitleCn            string      `json:"titleCn"`
		TitleSlug          string      `json:"titleSlug"`
		PaidOnly           bool        `json:"paidOnly"`
		FreqBar            interface{} `json:"freqBar"`
		IsFavor            bool        `json:"isFavor"`
		AcRate             float64     `json:"acRate"`
		Status             interface{} `json:"status"`
		SolutionNum        int         `json:"solutionNum"`
		HasVideoSolution   bool        `json:"hasVideoSolution"`
		TopicTags          []struct {
			Name           string `json:"name"`
			NameTranslated string `json:"nameTranslated"`
			ID             string `json:"id"`
		} `json:"topicTags"`
		Extra struct {
			TopCompanyTags []struct {
				ImgURL        string `json:"imgUrl"`
				Slug          string `json:"slug"`
				NumSubscribed int    `json:"numSubscribed"`
			} `json:"topCompanyTags"`
		} `json:"extra"`
	} `json:"question"`
	LastSubmission interface{} `json:"lastSubmission"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL