Git Product home page Git Product logo

leetcode-cli's Introduction

leetcode-cli

Rust crate doc downloads telegram LICENSE

Installing

# Required dependencies:
#
#  gcc
#  libssl-dev
#  libdbus-1-dev
#  libsqlite3-dev

cargo install leetcode-cli
Shell completions

For Bash and Zsh (by default picks up $SHELL from environment)

eval "$(leetcode completions)"

Copy the line above to .bash_profile or .zshrc

You may also obtain specific shell configuration using.

leetcode completions fish

If no argument is provided, the shell is inferred from the SHELL environment variable.

Usage

Make sure you have logged in to leetcode.com with Firefox. See Cookies for why you need to do this first.

leetcode 0.4.0
May the Code be with You ๐Ÿ‘ป

USAGE:
    leetcode [FLAGS] [SUBCOMMAND]

FLAGS:
    -d, --debug      debug mode
    -h, --help       Prints help information
    -V, --version    Prints version information

SUBCOMMANDS:
    data    Manage Cache [aliases: d]
    edit    Edit question by id [aliases: e]
    exec    Submit solution [aliases: x]
    list    List problems [aliases: l]
    pick    Pick a problem [aliases: p]
    stat    Show simple chart about submissions [aliases: s]
    test    Edit question by id [aliases: t]
    help    Prints this message or the help of the given subcommand(s)

Example

To configure leetcode-cli, create a file at ~/.leetcode/leetcode.toml):

[code]
editor = 'emacs'
# Optional parameter
editor_args = ['-nw']
# Optional environment variables (ex. [ "XDG_DATA_HOME=...", "XDG_CONFIG_HOME=...", "XDG_STATE_HOME=..." ])
editor_envs = []
lang = 'rust'
edit_code_marker = false
start_marker = ""
end_marker = ""
# if include problem description
comment_problem_desc = false
# comment syntax
comment_leading = ""
test = true

[cookies]
csrf = '<your-leetcode-csrf-token>'
session = '<your-leetcode-session-key>'

[storage]
cache = 'Problems'
code = 'code'
root = '~/.leetcode'
scripts = 'scripts'
Configuration Explanation
[code]
editor = 'emacs'
# Optional parameter
editor_args = ['-nw']
# Optional environment variables (ex. [ "XDG_DATA_HOME=...", "XDG_CONFIG_HOME=...", "XDG_STATE_HOME=..." ])
editor_envs = []
lang = 'rust'
edit_code_marker = true
start_marker = "start_marker"
end_marker = "end_marker"
# if include problem description
comment_problem_desc = true
# comment syntax
comment_leading = "//"
test = true

[cookies]
csrf = '<your-leetcode-csrf-token>'
session = '<your-leetcode-session-key>'

[storage]
cache = 'Problems'
code = 'code'
root = '~/.leetcode'
scripts = 'scripts'

If we change the configuration as shown previously, we will get the following code after leetcode edit 15.

// Category: algorithms
// Level: Medium
// Percent: 32.90331%

// Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0.
//
// Notice that the solution set must not contain duplicate triplets.
//
// ย 
// Example 1:
//
// Input: nums = [-1,0,1,2,-1,-4]
// Output: [[-1,-1,2],[-1,0,1]]
// Explanation:
// nums[0] + nums[1] + nums[2] = (-1) + 0 + 1 = 0.
// nums[1] + nums[2] + nums[4] = 0 + 1 + (-1) = 0.
// nums[0] + nums[3] + nums[4] = (-1) + 2 + (-1) = 0.
// The distinct triplets are [-1,0,1] and [-1,-1,2].
// Notice that the order of the output and the order of the triplets does not matter.
//
//
// Example 2:
//
// Input: nums = [0,1,1]
// Output: []
// Explanation: The only possible triplet does not sum up to 0.
//
//
// Example 3:
//
// Input: nums = [0,0,0]
// Output: [[0,0,0]]
// Explanation: The only possible triplet sums up to 0.
//
//
// ย 
// Constraints:
//
//
// 3 <= nums.length <= 3000
// -10โต <= nums[i] <= 10โต
//

// start_marker
impl Solution {
pub fn three_sum(nums: Vec<i32>) -> Vec<Vec<i32>> {

    }

}
// end_marker

Some linting tools/lsps will throw errors unless the necessary libraries are imported. leetcode-cli can generate this boilerplate automatically if the inject_before key is set. Similarly, if you want to test out your code locally, you can automate that with inject_after. For c++ this might look something like:

[code]
inject_before = ["#include<bits/stdc++.h>", "using namespace std;"]
inject_after = ["int main() {\n    Solution solution;\n\n}"]

1. pick

leetcode pick 1
leetcode pick --name "Two Sum"
[1] Two Sum is on the run...


Given an array of integers, return indices of the two numbers such that they add up to a specific target.

You may assume that each input would have exactly one solution, and you may not use the same element twice.

--------------------------------------------------

Example:


Given nums = [2, 7, 11, 15], target = 9,

Because nums[0] + nums[1] = 2 + 7 = 9,
return [0, 1].

2. edit

leetcode edit 1
# struct Solution;
impl Solution {
    pub fn two_sum(nums: Vec<i32>, target: i32) -> Vec<i32> {
        use std::collections::HashMap;
        let mut m: HashMap<i32, i32> = HashMap::new();

        for (i, e) in nums.iter().enumerate() {
            if let Some(v) = m.get(&(target - e)) {
                return vec![*v, i as i32];
            }

            m.insert(*e, i as i32).unwrap_or_default();
        }

        return vec![];
    }
}

3. test

leetcode test 1
  Accepted       Runtime: 0 ms

  Your input:    [2,7,11,15], 9
  Output:        [0,1]
  Expected:      [0,1]

4. exec

leetcode exec 1
  Success

  Runtime: 0 ms, faster than 100% of Rustonline submissions for Two Sum.

  Memory Usage: 2.4 MB, less than 100% of Rustonline submissions for Two Sum.

Cookies

The cookie plugin of leetcode-cli can work on OSX and Linux. If you are on a different platform, there are problems with caching the cookies, you can manually input your LeetCode Cookies to the configuration file.

[cookies]
csrf = "..."
session = "..."

For Example, using Firefox (after logging in to LeetCode):

Step 1

Open Firefox, press F12, and click Storage tab.

Step 2

Expand Cookies tab on the left and select https://leetcode.com.

Step 2

Copy Value from LEETCODE_SESSION and csrftoken to session and csrf in your configuration file, respectively:

[cookies]
csrf = '<your-leetcode-csrf-token>'
session = '<your-leetcode-session-key>'

Programmable

If you want to filter LeetCode questions using custom Python scripts, add the following to your the configuration file:

[storage]
scripts = "scripts"

Then write the script:

# ~/.leetcode/scripts/plan1.py
import json;

def plan(sps, stags):
    ##
    # `print` in python is supported,
    # if you want to know the data structures of these two args,
    # just print them
    ##
    problems = json.loads(sps)
    tags = json.loads(stags)

    ret = []
    tm = {}
    for tag in tags:
        tm[tag["tag"]] = tag["refs"];

    for i in problems:
        if i["level"] == 1 and str(i["id"]) in tm["linked-list"]:
            ret.append(str(i["id"]))

    # return is `List[string]`
    return ret

Then run list with the filter that you just wrote:

leetcode list -p plan1

That's it! Enjoy!

Contributions

Feel free to add your names and emails in the authors field of Cargo.toml !

LICENSE

MIT

leetcode-cli's People

Contributors

152334h avatar akarsh1995 avatar anstadnik avatar aymanbagabas avatar cauliyang avatar clearloop avatar congee avatar dependabot[bot] avatar dubeykartikay avatar frrad avatar genepg avatar gongsta avatar gotlougit avatar heeh avatar hilaolu avatar hulufei avatar illia-danko avatar ldm0 avatar manank20 avatar nasnoisaac avatar qwed81 avatar raees678 avatar ru5ty0ne avatar shmuga avatar subjective avatar theidexisted avatar v8yte avatar wendajiang avatar xiaoxiae avatar yqmmm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

leetcode-cli's Issues

Memory allocation error

Hi,

When I execute command "leetcode stat", only the chart of easy problems is drawn. Then there is a memory allocation error:

memory allocation of 18446744073709551615 bytes failed
[1] 13318 IOT instruction (core dumped) leetcode stat
(The number before "IOT" is different each time)

image

I just manually set the programming language to cpp and input the cookie from leetcode website in the toml config file. Other than that everything shoud be default. I've tried adding RUST_BACKTRACE=1 or -d but there is no additional error message. The program was newly built with stable rust 1.58.1.

I'm not very familiar with rust. Please let me know if I can do anything else to help debug. Thanks.

Flaws in version 0.3.12

I have been using leetcode-cli and it has been working well. Just installed version 0.3.12 and see immediate issues:

  1. Every time I run leetcode e 1 a new code directory is created in whatever directory I was previously in. Previously that directory was created wrt to the root setting. If I set the code path absolute then it ignores the ~ shortcut for users home directory which leetcode always respected previously.
  2. The file 1.two-sum.py gets created but it has C and C++ comments embedded all throughout (which looks incredibly ugly in my editor when trying to syntax highlight the file).
  3. An empty 1.two-sum.tests.dat file gets created.
  4. Documentation of changes is missing. What is @lc code=start/end about?
  5. README here says both edit and test functions are to Edit question by id.

There are probably more bugs since I have raised this in only the first 5 mins after installing 0.3.12.

Also, as a matter of process, it would be best to tag the repo with the version whenever a new crates.io release is made.

Test result failed to parse

I have tried some problems. All of them fail when I test.

Log

$ leetcode -d t 300  
....
[2022-08-15T09:11:53Z TRACE leetcode_cli::plugins::leetcode::req] Running leetcode::verify_result...
[2022-08-15T09:11:53Z DEBUG leetcode_cli::cache] debug resp raw text:
    "{\"status_code\": 10, \"lang\": \"python3\", \"run_success\": true, \"status_runtime\": \"41 ms\", \"memory\": 13816000, \"code_answer\": [\"4\", \"4\", \"1\"], \"code_output\": [], \"std_output\": [\"\", \"\", \"\", \"\"], \"elapsed_time\": 117, \"task_finish_time\": 1660554713056, \"expected_status_code\": 10, \"expected_lang\": \"cpp\", \"expected_run_success\": true, \"expected_status_runtime\": \"0\", \"expected_memory\": 6344000, \"expected_code_answer\": [\"4\", \"4\", \"1\"], \"expected_code_output\": [], \"expected_std_output\": [\"\", \"\", \"\", \"\"], \"expected_elapsed_time\": 15, \"expected_task_finish_time\": 1660553292680, \"correct_answer\": true, \"compare_result\": \"111\", \"total_correct\": 3, \"total_testcases\": 3, \"runtime_percentile\": null, \"status_memory\": \"13.8 MB\", \"memory_percentile\": null, \"pretty_lang\": \"Python3\", \"submission_id\": \"runcode_1660554710.6577528_ZjZep0dq0D\", \"status_msg\": \"Accepted\", \"state\": \"SUCCESS\"}"
[2022-08-15T09:11:53Z DEBUG leetcode_cli::cache] debug json deserializing:
    Err(
        Error("invalid type: sequence, expected a string", line: 1, column: 172),
    )
error: invalid type: sequence, expected a string at line 1 column 172

Get Password failed: NoPasswordFound

Hey there! When I use subcommands in leetcode-cli, problem like this occurs:

$ leetcode pick 1
thread 'main' panicked at 'Get Password failed: NoPasswordFound', /home/ofey/.cargo/registry/src/github.com-1ecc6299db9ec823/leetcode-cli-0.3.2/src/plugins/chrome.rs:76:36
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

With RUST_BACKTRACE=1:

$ RUST_BACKTRACE=1 leetcode list
thread 'main' panicked at 'Get Password failed: NoPasswordFound', /home/ofey/.cargo/registry/src/github.com-1ecc6299db9ec823/leetcode-cli-0.3.2/src/plugins/chrome.rs:76:36
stack backtrace:
   0: rust_begin_unwind
             at /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/library/std/src/panicking.rs:493:5
   1: core::panicking::panic_fmt
             at /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/library/core/src/panicking.rs:92:14
   2: core::option::expect_none_failed
             at /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/library/core/src/option.rs:1329:5
   3: leetcode_cli::plugins::chrome::cookies
   4: leetcode_cli::plugins::leetcode::LeetCode::new
   5: leetcode_cli::cache::Cache::new
   6: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
   7: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
   8: tokio::macros::scoped_tls::ScopedKey<T>::set
   9: tokio::runtime::basic_scheduler::BasicScheduler<P>::block_on
  10: tokio::runtime::context::enter
  11: tokio::runtime::Runtime::block_on
  12: leetcode::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

My system is fedora 33 workstation, I initially login leetcode with github, and I encounter this problem.

After that, I set leetcode password, logout leetcode, clear all cookies from leetcode, then relogin with my username and password. However, this problem is still there.

Thank you for your attention โญ

thread 'main' panicked at 'failed printing to stdout: Broken pipe (os error 32)' when piping

The program doesn't seem to handle broken pipes well. When doing

leetcode list -q eLD | head -n 1

to get the next easy unlocked problem that I haven't solved, the following happens:

        [ 122] Best Time to Buy and Sell Stock II                           Easy   (57.55 %)
thread 'main' panicked at 'failed printing to stdout: Broken pipe (os error 32)', library/std/src/io/stdio.rs:993:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Googling around, this might be of use.

leetcode list -p plan1 filtering not working

Hey, followed the example from

# ~/.leetcode/scripts/plan1.py
import json;

def plan(sps, stags):
    ##
    # `print` in python is supported, 
    # if you want to know the data structures of these two args, 
    # just print them
    ##
    problems = json.loads(sps)
    tags = json.loads(stags)
	
    ret = []
    tm = {}
    for tag in tags:
        tm[tag["tag"]] = tag["refs"];

    for i in problems:
        if i["level"] == 1 and str(i["id"]) in tm["linked-list"]:
            ret.append(str(i["id"]))

    # return is `List[string]`
    return ret
$ ls ~/.leetcode/scripts
blind75.py plan1.py
leetcode list -p plan1

...
  ๐Ÿ”’    [2282] Number of People That Can Be Seen in a Grid                  Medium (50.67 %)
  ๐Ÿ”’    [2291] Maximum Profit From Trading Stocks                           Medium (48.73 %)
  ๐Ÿ”’    [2292] Products With Three or More Orders in Two Consecutive Years  Medium (36.96 %)
  ๐Ÿ”’    [2298] Tasks Count in the Weekend                                   Medium (87.84 %)
  ๐Ÿ”’    [2308] Arrange Table by Gender                                      Medium (78.74 %)
  ๐Ÿ”’    [2314] The First Day of the Maximum Recorded Degree in Each City    Medium (79.27 %)
  ๐Ÿ”’    [2324] Product Sales Analysis IV                                    Medium (87.50 %)
  ๐Ÿ”’    [2329] Product Sales Analysis V                                     Medium (82.71 %)
  ๐Ÿ”’    [2323] Find Minimum Time to Finish All Jobs II                      Medium (78.78 %)
  ๐Ÿ”’    [2330] Valid Palindrome IV                                          Medium (78.99 %)
 ...

Still getting all of the problems

installation error on mac os

~ > leetcode list
error: missing field sys at line 2 column 1, Parse config file failed,
leetcode-cli has just generated a new leetcode.toml at ~/.leetcode/leetcode_
tmp.toml, the current one at ~/.leetcode/leetcode.tomlseems missing some
keys, please compare to the tmp one and add them up : )

~ > ls .leetcode

leetcode.toml

~ > cat .leetcode/leetcode.toml

[code]
editor = "vim"
lang = "java"

[cookies]
csrf = "........"
session = "........"

~ > cargo -V

cargo 1.61.0 (a028ae42f 2022-04-29)

~ > rustc -V

rustc 1.61.0 (fe5b13d68 2022-05-18)

~ > brew list

openssl@3 dbus [email protected] sqlite

~ > gcc -v

Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx
-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/
include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

anything else I need to install or update ?
Thanks.

leetcode edit doesn't do anything

Hi, I just installed leetcode-cli

the command leetcode pick 1128 works well, however the command leetcode edit doesn't seem to work
~ > leetcode edit 1128 error: No such file or directory (os error 2), please try again

however the command seems to create files into my ~/.leetcode/code/ directory

~/.leetcode/code > ls
Permissions Size User Date Modified Name
.rw-rw-r-- 98 ori 11 Apr 19:26 1.two-sum.cpp
.rw-rw-r-- 94 ori 11 Apr 19:24 1.two-sum.rs
.rw-rw-r-- 31 ori 11 Apr 19:26 1.two-sum.tests.dat
.rw-rw-r-- 370 ori 11 Apr 19:39 2.add-two-numbers.cpp
.rw-rw-r-- 49 ori 11 Apr 19:39 2.add-two-numbers.tests.dat
.rw-rw-r-- 103 ori 11 Apr 19:29 1128.number-of-equivalent-domino-pairs.cpp
.rw-rw-r-- 57 ori 11 Apr 19:29 1128.number-of-equivalent-domino-pairs.tests.dat

I am using zsh and ubuntu 20.04 if this can help

Optimize error messages

@hao-lee that may be true but it is almost irrelevant to this issue. The error message implies the program is not handling the leetcode response correctly and thus it should be fixed.

We could close this issue then the next new user who comes along and hits this error will likely do exactly what the error message tells him, i.e come here and raise another new bug. Is that what we want?

Originally posted by @bulletmark in #57 (comment)

Feature request: add questions' link to the output of pick.

Currently, "leetcode pick 1"'s output is:

[1] Two Sum is on the run...

Given an array of integers numsย and an integer target, return indices of the two numbers such that they add up to target.

You may assume that each input would have exactly one solution, and you may not use the same element twice.

You can return the answer in any order.
...

Expected:

[1] Two Sum is on the run...

https://leetcode.com/problems/two-sum/

Given an array of integers numsย and an integer target, return indices of the two numbers such that they add up to target.

You may assume that each input would have exactly one solution, and you may not use the same element twice.

You can return the answer in any order.
...

Reason: many people like me save the output to a file for later review. Adding the link will make it easier to jump to the web.

Thanks.

feature request: support concurrecy category

I can't see problems from the concurrency category https://leetcode.com/problemset/concurrency/

editing leetcode.toml to include this category in the categories list results in the following error:

error: invalid length 4, expected 3 elements in sequence for key `sys.categories` at line 55 co
lumn 1, Parse config file failed, leetcode-cli has just generated a new leetcode.toml at ~/.lee
tcode/leetcode_tmp.toml, the current one at ~/.leetcode/leetcode.tomlseems missing some keys, p
lease compare to the tmp one and add them up : )
.

leetcode pick throws MASSIVE error message

I installed this from the AUR. When I try to get some questions, i get this error.
the full error in its glory:

[2022-04-04T01:03:14Z TRACE leetcode_cli::plugins::chrome] Derive cookies from google chrome...
[2022-04-04T01:03:14Z DEBUG leetcode_cli::plugins::chrome] Chrome Cookies path is "/home/minhduc/.config/google-chrome/Default/Cookies"
[2022-04-04T01:03:14Z DEBUG leetcode_cli::plugins::chrome] res [Cookies { encrypted_value: [118, 49, 48, 96, 52, 136, 160, 193, 98, 62, 47, 236, 231, 73, 22, 53, 93, 45, 33, 128, 204, 123, 50, 22, 57, 17, 138, 200, 107, 4, 174, 87, 144, 235, 33, 147, 58, 83, 191, 174, 53, 128, 64, 147, 166, 153, 26, 99, 158, 216, 76], host_key: ".leetcode.com", name: "87b5a3c3f1a55520_gr_session_id" }, Cookies { encrypted_value: [118, 49, 48, 88, 253, 17, 70, 255, 27, 53, 252, 183, 28, 124, 198, 108, 102, 250, 179], host_key: ".leetcode.com", name: "87b5a3c3f1a55520_gr_session_id_926dfc6f-43d1-41ef-8899-fd381fe5201c" }, Cookies { encrypted_value: [118, 49, 48, 114, 28, 86, 212, 209, 255, 52, 14, 68, 147, 12, 172, 105, 183, 5, 165, 251, 35, 196, 70, 210, 182, 97, 93, 215, 105, 81, 213, 78, 175, 178, 93], host_key: ".leetcode.com", name: "_ga" }, Cookies { encrypted_value: [118, 49, 48, 158, 89, 233, 206, 24, 223, 54, 208, 235, 212, 10, 249, 197, 63, 2, 221, 142, 249, 18, 212, 92, 205, 74, 5, 134, 82, 103, 13, 243, 70, 158, 223], host_key: ".leetcode.com", name: "_gid" }, Cookies { encrypted_value: [118, 49, 48, 206, 237, 180, 201, 173, 164, 182, 189, 161, 133, 3, 69, 75, 181, 97, 28, 237, 140, 132, 48, 149, 242, 134, 195, 178, 2, 159, 76, 70, 92, 200, 67, 70, 197, 122, 86, 47, 243, 1, 224, 251, 75, 219, 244, 166, 113, 131, 83], host_key: ".leetcode.com", name: "gr_user_id" }, Cookies { encrypted_value: [118, 49, 48, 7, 73, 97, 211, 155, 97, 186, 190, 198, 249, 107, 114, 40, 74, 155, 51, 60, 2, 107, 242, 207, 75, 199, 160, 246, 73, 146, 92, 150, 179, 206, 240, 68, 36, 24, 60, 18, 156, 95, 106, 177, 208, 52, 31, 11, 166, 11, 14, 124, 93, 59, 56, 246, 14, 245, 14, 151, 44, 97, 250, 12, 76, 242, 150, 24, 52, 20, 190, 249, 44, 230, 167, 198, 147, 78, 166, 249, 209, 107, 243, 206, 251, 91, 78, 220, 168, 232, 45, 109, 134, 173, 124, 57, 73, 34, 125, 27, 1, 132, 10, 104, 43, 233, 27, 70, 219, 223, 212, 178, 49, 35, 133, 146, 115, 90, 210, 210, 177, 111, 48, 54, 202, 109, 97, 224, 159, 55, 174, 224, 102, 80, 129, 108, 191, 144, 163, 105, 250, 43, 112, 92, 19, 207, 11, 42, 175, 93, 119, 205, 111, 180, 182, 188, 117, 72, 89, 33, 173, 59, 244, 200, 3, 182, 17, 119, 69, 120, 159, 189, 17, 158, 170, 132, 80, 76, 155, 25, 23, 246, 208, 144, 173, 25, 159, 141, 219, 53, 84, 171, 252, 26, 47, 111, 207, 118, 244, 162, 226, 154, 147, 176, 64, 131, 146, 157, 102, 69, 49, 152, 79, 217, 86, 155, 226, 224, 216, 84, 60, 146, 44, 33, 60, 180, 104, 35, 158, 147, 17, 204, 124, 71, 219, 239, 246, 191, 20, 212, 238, 54, 167, 133, 100, 7, 60, 204, 217, 132, 123, 48, 127, 192, 104, 188, 51, 53, 213, 86, 211, 189, 32, 145, 110, 17, 174, 63, 26, 51, 58, 211, 57, 112, 8, 201, 214, 117, 246, 67, 3, 3, 109, 160, 66, 13, 50, 191, 39, 138, 251, 18, 38, 151, 44, 157, 209, 114, 134, 139, 48, 58, 229, 69, 201, 144, 140, 68, 158, 0, 173, 140, 85, 92, 132, 79, 53, 47, 226, 47, 108, 203, 17, 127, 232, 173, 249, 120, 107, 174, 32, 76, 151, 99, 230, 67, 32, 70, 90, 244, 9, 17, 58, 234, 31, 72, 31, 103, 163, 112, 190, 120, 234, 33, 97, 160, 96, 23, 190, 204, 124, 191, 47, 183, 181, 49, 85, 224, 222, 80, 120, 204, 246, 169, 123, 96, 242, 89, 221, 50, 95, 178, 51, 206, 227, 49, 251, 62, 122, 225, 36, 111, 232, 253, 180, 209, 95, 122, 57, 255, 22, 115, 47, 10, 143, 60, 79, 73, 62, 227, 152, 142, 40, 106, 201, 219, 147, 109, 218, 34, 69, 109, 17, 207, 48, 7, 154, 123, 229, 103, 187, 157, 126, 113, 185, 97, 99, 229, 222, 198, 123, 114, 77, 101, 68, 166, 0, 91, 186, 204, 71, 99, 192, 223, 4, 167, 5, 182, 164, 183, 211, 190, 144, 23, 95, 173, 248, 140, 80, 108, 146, 102, 16, 30, 62, 85, 178, 175, 104, 112, 231, 79, 16, 25, 77, 59, 179, 133, 37, 224, 73, 163, 76, 29, 182, 212, 214, 144, 56, 2, 198, 186, 143, 60, 197, 104, 199, 75, 100, 64, 42, 156, 188, 250, 209, 135, 107, 183, 101, 169, 70, 94, 147, 45, 148, 168, 230, 25, 98, 214, 192, 39, 234, 64, 199, 229, 40, 196, 116, 194, 235, 114, 238, 90, 91, 57, 178, 34, 79, 187, 171, 52, 170, 78, 252, 109, 207, 127, 25, 239, 181, 135, 191, 130, 180, 20, 109, 121, 107, 173, 164, 246, 204, 150, 18, 156, 180, 215, 231, 57, 68, 150, 187, 151, 18, 142, 40, 29, 43, 211, 170, 190, 142, 30, 1, 213, 141, 175, 229, 75, 190, 76, 148, 173, 32, 186, 197, 95, 174, 160, 202, 17, 164, 167, 148, 163, 37, 65, 17, 179, 64, 78, 47, 125, 238, 93, 1, 161, 14, 60, 81, 34, 127, 249, 60, 203, 230, 99, 226, 125, 120, 160, 6, 156, 153, 54, 10, 99, 179, 4, 176, 96, 165, 57, 34, 153, 197, 106, 168, 138, 138, 65, 185, 208, 203, 193, 27, 25, 201, 99, 125, 73, 144, 60, 228, 43, 121, 105, 8, 92, 21, 15, 136, 139, 62, 239, 172, 59, 153, 36, 133, 220, 109, 76, 134, 128, 235, 208, 219, 216, 87, 170, 53, 97, 83, 71, 183, 11, 85, 37, 5, 40, 72, 71, 72, 118, 11, 47, 4, 214, 228, 8, 237], host_key: ".leetcode.com", name: "LEETCODE_SESSION" }, Cookies { encrypted_value: [118, 49, 48, 75, 244, 234, 142, 142, 127, 151, 248, 177, 196, 185, 230, 228, 112, 216, 113, 225, 34, 241, 41, 137, 232, 191, 183, 142, 209, 99, 226, 5, 248, 10, 188, 197, 159, 196, 59, 14, 105, 188, 253, 245, 242, 48, 81, 17, 216, 19, 104, 8, 248, 197, 91, 46, 50, 141, 175, 247, 124, 43, 186, 188, 193, 84, 5, 119, 108, 103, 54, 14, 48, 218, 94, 170, 102, 157, 85, 71, 51, 92, 19], host_key: "leetcode.com", name: "csrftoken" }]
thread 'main' panicked at 'Get Password failed: SecretServiceError(Dbus(D-Bus error: The name org.freedesktop.secrets was not provided by any .service files (org.freedesktop.DBus.Error.ServiceUnknown)))', src/plugins/chrome.rs:77:36
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

command: leetcode -d pick
I also logged in to leetcode on chrome
any ideas how to fix?

error: expected value at line 1 column 1

Hello, I encountered a strange problem... Can't figure out what's wrong ๐Ÿ˜ข ... Thanks.

~# leetcode pick 55
~# leetcode edit 55 # add a line: return True
~# leetcode test 55
[INFO  leetcode_cli::plugins::leetcode] Sending code to judge...
error: expected value at line 1 column 1

leetcode test 5: panic

leetcode test 5
[INFO  leetcode_cli::plugins::leetcode] Sending code to judge...
thread 'main' panicked at 'submit succcessfully, parse question_id to i32 failed: ParseIntError { kind: Empty }', src/cache/models.rs:318:34
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

and the 5 source file

class Solution {
   public:
    // 1. ไธญๅฟƒๆ‰ฉๅฑ•ๆณ•
    tuple<int, int, int> expandPalindrome(string &s, int left, int right) {
        int k = 0;
        while (left >= 0 && right < s.size()) {
            if (s[left] == s[right]) {
                left--;
                right++;
                k++;
            } else {
                break;
            }
        }
        return make_tuple(k, left, right);
    }
    string longestPalindrome(string s) {
        if (s.size() == 0) return s;
        int max_length = 1;
        int l = 0, r = 0;
        for (size_t i = 0; i < s.size(); i++) {
            int k_o = 0, k_e = 0;
            int l_o = 0, l_e = 0;
            int r_o = 0, r_e = 0;
            tie(k_e, l_e, r_e) = expandPalindrome(s, i - 1, i + 1);
            tie(k_o, l_o, r_o) = expandPalindrome(s, i, i + 1);
            if (k_e * 2 + 1 > max_length) {
                max_length = k_e * 2 + 1;
                l = l_e;
                r = r_e;
            }
            if (k_o * 2 > max_length) {
                max_length = k_o * 2;
                l = l_o;
                r = r_o;
            }
        }
        return s.substr(l + 1, r);
    }
};

"leetcode list" output should be sorted.

Observed
Currently, it's not sorted. Etc

    [2224] Minimum Number of Operations to Convert Time                 Easy   (61.81 %)

๐Ÿ”’ [2214] Minimum Health to Beat Game Medium (58.87 %)
๐Ÿ”’ [2219] Maximum Sum Score of Array Medium (66.86 %)
๐Ÿ”’ [2228] Users With Two Purchases Within Seven Days Medium (47.86 %)
๐Ÿ”’ [2230] The Users That Are Eligible for Discount Easy (49.48 %)
๐Ÿ”’ [2238] Number of Times a Driver Was a Passenger Medium (80.36 %)
[2235] Add Two Integers Easy (93.47 %)
[2236] Root Equals Sum of Children Easy (91.30 %)
๐Ÿ”’ [2237] Count Positions on Street With Required Brightness Medium (72.88 %)

Expected:
It should be sorted.

Thanks.

Can I require a feature?

I also use the (codeforces cli)[https://github.com/woshiluo/cf-tool], which has a very interesting feature cf open would just open the problem page you're working on.
it's implemented by this lib: https://github.com/skratchdot/open-golang which invokes open on mac, start on windows and xdg-open on linux to open a given url on web browsers.

I think leetcode open pid or leetcode pick pid -o would also be very handy in use

Failed to parse json data

I met this message when pick a problem.

$ leetcode pick 694

[694] Number of Distinct Islands is on the run...

json from response parse failed, please open a new issue at: https://github.com/clearloop/leetcode-cli/.

$ leetcode --version
leetcode-cli 0.3.11

Programmable leetcode-cli

About programmable leetcode-cli, all leetcode-cli needs is an extension language runtime โ€”โ€” after browsing interpreterใ€JITใ€lang tags in crates.io, finally got these thoughts:

v8

v8 engine is the first thought appear in my mind, writing javascript as leetcode-cli script, it's awesome, most programmers can do it!

Unfortunately, v8-rs is too old to use, and some new crates are too heavy.

rusti?

The second choice is calling rustc and rust_llvm to run rust as scripts.

The "scripts" are born to run, but on the other hand, rust users might be a little part of leetcode-cli users, or might not, not sure about it.

wasm

wasm is also a choice, but in a word, wasm belongs to assembly, not scripts, writing wasm to implement scripts for some processes...it's unnecessary, too complex.

ketos?

I like this idea, a Lisp dialect running as scripts, it's perfect but not easy to use.

pyo3!

Then I found this repo, pyo3 is what leetcode-cli needs โ€”โ€” invoking python scripts, easy to use!

And the repo has just updated 2 days before, up-to-date.

Pym

So, leetcode-cli will add a new mod named Pym:

//! Python virtual machine
/// Pass fixed `problems` and `tags` as `PyArgs` to `Pym`.
type PyArgs = (Vec<Problem>, Vec<Tag>);

/// Return ids
type PyRet = Vec<String>;

trait Pym {
  /// Return filter results.
  fn run(&self, args: PyArgs) -> Result<PyRet, Error>;
}

Users can write python filter scripts manually, for Example:

# filter all easy linked-list questions
def plan_1(problems, tags):
  ids = [];
  for i in problems:
    if (i.level == "1") and (i.id in tags.get("linked-list")):
      ids.append(i.id)

  return ids;

Bug report: wrong code template for 122.best-time-to-buy-and-sell-stock-ii.cpp

To reproduce:

leetcode e 122

We get the source file name: ~/.leetcode/code/122.best-time-to-buy-and-sell-stock-ii.cpp

But with wrong content:

/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     TreeNode *left;
 *     TreeNode *right;
 *     TreeNode() : val(0), left(nullptr), right(nullptr) {}
 *     TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
 *     TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
 * };
 */
class Solution {
public:
    vector<vector<int>> zigzagLevelOrder(TreeNode* root) {
        
    }
};

Find with version: leetcode-cli 0.3.11

`leetcode edit 1` throws error: No such file or directory (os error 2), please try again

Hi there, I'm having a trouble editing a problem by executing leetcode edit 1. After straceing it, a line close to the bottom of the log below seems suspicious. write(6, "\1", 1) = 1. I'm not sure what that fd 6 is, but it's cuasing an error

error: No such file or directory (os error 2), please try again

I'm using the version 0.2.25

can anyone please help?

execve("/home/congee/.cargo/bin/leetcode", ["leetcode", "e", "1"], 0x7ffc143b8440 /* 54 vars */) = 0
brk(NULL)                               = 0x561d67cdc000
arch_prctl(0x3001 /* ARCH_??? */, 0x7ffcfb990260) = -1 EINVAL (Invalid argument)
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=68555, ...}) = 0
mmap(NULL, 68555, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7efc84047000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/libssl.so.1.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p\367\1\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=598104, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7efc84045000
mmap(NULL, 600368, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7efc83fb2000
mprotect(0x7efc83fce000, 434176, PROT_NONE) = 0
mmap(0x7efc83fce000, 323584, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1c000) = 0x7efc83fce000
mmap(0x7efc8401d000, 106496, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x6b000) = 0x7efc8401d000
mmap(0x7efc84038000, 53248, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x85000) = 0x7efc84038000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/libcrypto.so.1.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\220\7\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=2954080, ...}) = 0
mmap(NULL, 2973600, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7efc83cdc000
mmap(0x7efc83d54000, 1683456, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x78000) = 0x7efc83d54000
mmap(0x7efc83eef000, 593920, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x213000) = 0x7efc83eef000
mmap(0x7efc83f80000, 188416, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2a3000) = 0x7efc83f80000
mmap(0x7efc83fae000, 16288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7efc83fae000
close(3)                                = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libdbus-1.so.3", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260\276\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=325944, ...}) = 0
mmap(NULL, 328400, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7efc83c8b000
mprotect(0x7efc83c96000, 278528, PROT_NONE) = 0
mmap(0x7efc83c96000, 188416, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xb000) = 0x7efc83c96000
mmap(0x7efc83cc4000, 86016, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x39000) = 0x7efc83cc4000
mmap(0x7efc83cda000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x4e000) = 0x7efc83cda000
close(3)                                = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 \22\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=18816, ...}) = 0
mmap(NULL, 20752, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7efc83c85000
mmap(0x7efc83c86000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1000) = 0x7efc83c86000
mmap(0x7efc83c88000, 4096, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7efc83c88000
mmap(0x7efc83c89000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7efc83c89000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/libsqlite3.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\346\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=1212216, ...}) = 0
mmap(NULL, 1216056, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7efc83b5c000
mprotect(0x7efc83b6a000, 1134592, PROT_NONE) = 0
mmap(0x7efc83b6a000, 917504, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xe000) = 0x7efc83b6a000
mmap(0x7efc83c4a000, 212992, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xee000) = 0x7efc83c4a000
mmap(0x7efc83c7f000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x122000) = 0x7efc83c7f000
close(3)                                = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\3405\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=104984, ...}) = 0
mmap(NULL, 107592, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7efc83b41000
mmap(0x7efc83b44000, 73728, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7efc83b44000
mmap(0x7efc83b56000, 16384, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x15000) = 0x7efc83b56000
mmap(0x7efc83b5a000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x18000) = 0x7efc83b5a000
close(3)                                = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360q\2\0\0\0\0\0"..., 832) = 832
pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784
pread64(3, "\4\0\0\0\20\0\0\0\5\0\0\0GNU\0\2\0\0\300\4\0\0\0\3\0\0\0\0\0\0\0", 32, 848) = 32
pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\363\377?\332\200\270\27\304d\245n\355Y\377\t\334"..., 68, 880) = 68
fstat(3, {st_mode=S_IFREG|0755, st_size=2029224, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7efc83b3f000
pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784
pread64(3, "\4\0\0\0\20\0\0\0\5\0\0\0GNU\0\2\0\0\300\4\0\0\0\3\0\0\0\0\0\0\0", 32, 848) = 32
pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\363\377?\332\200\270\27\304d\245n\355Y\377\t\334"..., 68, 880) = 68
mmap(NULL, 2036952, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7efc8394d000
mprotect(0x7efc83972000, 1847296, PROT_NONE) = 0
mmap(0x7efc83972000, 1540096, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x25000) = 0x7efc83972000
mmap(0x7efc83aea000, 303104, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x19d000) = 0x7efc83aea000
mmap(0x7efc83b35000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1e7000) = 0x7efc83b35000
mmap(0x7efc83b3b000, 13528, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7efc83b3b000
close(3)                                = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libm.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\300\363\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=1369352, ...}) = 0
mmap(NULL, 1368336, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7efc837fe000
mmap(0x7efc8380d000, 684032, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xf000) = 0x7efc8380d000
mmap(0x7efc838b4000, 618496, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xb6000) = 0x7efc838b4000
mmap(0x7efc8394b000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x14c000) = 0x7efc8394b000
close(3)                                = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\220\201\0\0\0\0\0\0"..., 832) = 832
pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0O\305\3743\364B\2216\244\224\306@\261\23\327o"..., 68, 824) = 68
fstat(3, {st_mode=S_IFREG|0755, st_size=157224, ...}) = 0
pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0O\305\3743\364B\2216\244\224\306@\261\23\327o"..., 68, 824) = 68
mmap(NULL, 140408, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7efc837db000
mmap(0x7efc837e2000, 69632, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7000) = 0x7efc837e2000
mmap(0x7efc837f3000, 20480, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x18000) = 0x7efc837f3000
mmap(0x7efc837f8000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1c000) = 0x7efc837f8000
mmap(0x7efc837fa000, 13432, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7efc837fa000
close(3)                                = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libsystemd.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360\r\1\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=701152, ...}) = 0
mmap(NULL, 705776, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7efc8372e000
mmap(0x7efc8373e000, 471040, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x10000) = 0x7efc8373e000
mmap(0x7efc837b1000, 151552, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x83000) = 0x7efc837b1000
mmap(0x7efc837d6000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xa7000) = 0x7efc837d6000
mmap(0x7efc837da000, 1264, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7efc837da000
close(3)                                = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/librt.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 7\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=40040, ...}) = 0
mmap(NULL, 44000, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7efc83723000
mprotect(0x7efc83726000, 24576, PROT_NONE) = 0
mmap(0x7efc83726000, 16384, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7efc83726000
mmap(0x7efc8372a000, 4096, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7000) = 0x7efc8372a000
mmap(0x7efc8372c000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x8000) = 0x7efc8372c000
close(3)                                = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/liblzma.so.5", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\3003\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=162264, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7efc83721000
mmap(NULL, 164104, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7efc836f8000
mprotect(0x7efc836fb000, 147456, PROT_NONE) = 0
mmap(0x7efc836fb000, 98304, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7efc836fb000
mmap(0x7efc83713000, 45056, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1b000) = 0x7efc83713000
mmap(0x7efc8371f000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x26000) = 0x7efc8371f000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/liblz4.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 !\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=129248, ...}) = 0
mmap(NULL, 131168, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7efc836d7000
mmap(0x7efc836d9000, 106496, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7efc836d9000
mmap(0x7efc836f3000, 12288, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1c000) = 0x7efc836f3000
mmap(0x7efc836f6000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1e000) = 0x7efc836f6000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/libgcrypt.so.20", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200\305\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=1168056, ...}) = 0
mmap(NULL, 1171400, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7efc835b9000
mmap(0x7efc835c5000, 843776, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xc000) = 0x7efc835c5000
mmap(0x7efc83693000, 249856, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xda000) = 0x7efc83693000
mmap(0x7efc836d0000, 28672, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x116000) = 0x7efc836d0000
close(3)                                = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libgpg-error.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0`L\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=137584, ...}) = 0
mmap(NULL, 139872, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7efc83596000
mmap(0x7efc8359a000, 77824, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x4000) = 0x7efc8359a000
mmap(0x7efc835ad000, 40960, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17000) = 0x7efc835ad000
mmap(0x7efc835b7000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x20000) = 0x7efc835b7000
close(3)                                = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7efc83594000
mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7efc83591000
arch_prctl(ARCH_SET_FS, 0x7efc83591b40) = 0
mprotect(0x7efc83b35000, 12288, PROT_READ) = 0
mprotect(0x7efc835b7000, 4096, PROT_READ) = 0
mprotect(0x7efc836d0000, 8192, PROT_READ) = 0
mprotect(0x7efc836f6000, 4096, PROT_READ) = 0
mprotect(0x7efc837f8000, 4096, PROT_READ) = 0
mprotect(0x7efc8371f000, 4096, PROT_READ) = 0
mprotect(0x7efc8372c000, 4096, PROT_READ) = 0
mprotect(0x7efc837d6000, 12288, PROT_READ) = 0
mprotect(0x7efc8394b000, 4096, PROT_READ) = 0
mprotect(0x7efc83b5a000, 4096, PROT_READ) = 0
mprotect(0x7efc83c89000, 4096, PROT_READ) = 0
mprotect(0x7efc83c7f000, 12288, PROT_READ) = 0
mprotect(0x7efc83cda000, 4096, PROT_READ) = 0
mprotect(0x7efc83f80000, 180224, PROT_READ) = 0
mprotect(0x7efc84038000, 36864, PROT_READ) = 0
mprotect(0x561d65ee6000, 589824, PROT_READ) = 0
mprotect(0x7efc84085000, 4096, PROT_READ) = 0
munmap(0x7efc84047000, 68555)           = 0
set_tid_address(0x7efc83591e10)         = 16345
set_robust_list(0x7efc83591e20, 24)     = 0
rt_sigaction(SIGRTMIN, {sa_handler=0x7efc837e2bf0, sa_mask=[], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x7efc837f03c0}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {sa_handler=0x7efc837e2c90, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART|SA_SIGINFO, sa_restorer=0x7efc837f03c0}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
brk(NULL)                               = 0x561d67cdc000
brk(0x561d67cfd000)                     = 0x561d67cfd000
rt_sigaction(SIGPIPE, {sa_handler=SIG_IGN, sa_mask=[PIPE], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7efc83993210}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
openat(AT_FDCWD, "/proc/self/maps", O_RDONLY|O_CLOEXEC) = 3
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
read(3, "561d658ab000-561d65962000 r--p 0"..., 1024) = 1024
read(3, "0-7efc835b8000 r--p 00020000 08:"..., 1024) = 1024
read(3, "linux-gnu/liblz4.so.1.9.2\n7efc83"..., 1024) = 1024
read(3, "u/liblzma.so.5.2.4\n7efc83721000-"..., 1024) = 1024
read(3, "   /lib/x86_64-linux-gnu/libsyst"..., 1024) = 1024
read(3, "x86_64-linux-gnu/libm-2.31.so\n7e"..., 1024) = 1024
read(3, "000 rw-p 001ea000 08:10 25605   "..., 1024) = 1024
read(3, "te3.so.0.8.6\n7efc83c7e000-7efc83"..., 1024) = 1024
read(3, ".19.11\n7efc83c96000-7efc83cc4000"..., 1024) = 1024
read(3, "linux-gnu/libcrypto.so.1.1\n7efc8"..., 1024) = 1024
read(3, "\n7efc84059000-7efc8407c000 r-xp "..., 1024) = 715
close(3)                                = 0
sched_getaffinity(16345, 32, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) = 32
rt_sigaction(SIGSEGV, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGSEGV, {sa_handler=0x561d65d183c0, sa_mask=[], sa_flags=SA_RESTORER|SA_ONSTACK|SA_SIGINFO, sa_restorer=0x7efc83993210}, NULL, 8) = 0
rt_sigaction(SIGBUS, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGBUS, {sa_handler=0x561d65d183c0, sa_mask=[], sa_flags=SA_RESTORER|SA_ONSTACK|SA_SIGINFO, sa_restorer=0x7efc83993210}, NULL, 8) = 0
sigaltstack(NULL, {ss_sp=NULL, ss_flags=SS_DISABLE, ss_size=0}) = 0
mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7efc84055000
mprotect(0x7efc84055000, 4096, PROT_NONE) = 0
sigaltstack({ss_sp=0x7efc84056000, ss_flags=0, ss_size=8192}, NULL) = 0
getrandom("\xe3\x5b\x5d\x4a\x9a\x17\x83\x09\x01\x92\xea\xb8\xfd\x75\xcc\x55", 16, GRND_NONBLOCK) = 16
ioctl(2, TCGETS, 0x7ffcfb98e6d0)        = -1 ENOTTY (Inappropriate ioctl for device)
statx(0, NULL, AT_STATX_SYNC_AS_STAT, STATX_ALL, NULL) = -1 EFAULT (Bad address)
statx(AT_FDCWD, "/home/congee/.leetcode", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_ALL, stx_attributes=0, stx_mode=S_IFDIR|0755, stx_size=4096, ...}) = 0
statx(AT_FDCWD, "/home/congee/.leetcode/leetcode.toml", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_ALL, stx_attributes=0, stx_mode=S_IFREG|0644, stx_size=2015, ...}) = 0
openat(AT_FDCWD, "/home/congee/.leetcode/leetcode.toml", O_RDONLY|O_CLOEXEC) = 3
statx(3, "", AT_STATX_SYNC_AS_STAT|AT_EMPTY_PATH, STATX_ALL, {stx_mask=STATX_ALL, stx_attributes=0, stx_mode=S_IFREG|0644, stx_size=2015, ...}) = 0
read(3, "[sys]\ncategories = [\n    'algori"..., 2016) = 2015
read(3, "", 1)                          = 0
close(3)                                = 0
lstat("/home/congee/.leetcode/Problems", {st_mode=S_IFREG|0644, st_size=282624, ...}) = 0
getpid()                                = 16345
getpid()                                = 16345
openat(AT_FDCWD, "/home/congee/.leetcode/Problems", O_RDWR|O_CREAT|O_NOFOLLOW|O_CLOEXEC, 0644) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=282624, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=282624, ...}) = 0
stat("/home/congee/.leetcode/Problems", {st_mode=S_IFREG|0644, st_size=282624, ...}) = 0
pread64(3, "SQLite format 3\0\20\0\1\1\0@  \0\0\0\4\0\0\0E"..., 100, 0) = 100
fcntl(3, F_SETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=1073741824, l_len=1}) = 0
fcntl(3, F_SETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=1073741826, l_len=510}) = 0
fcntl(3, F_SETLK, {l_type=F_UNLCK, l_whence=SEEK_SET, l_start=1073741824, l_len=1}) = 0
stat("/home/congee/.leetcode/Problems-journal", 0x7ffcfb98bbc0) = -1 ENOENT (No such file or directory)
stat("/home/congee/.leetcode/Problems-wal", 0x7ffcfb98bbc0) = -1 ENOENT (No such file or directory)
fstat(3, {st_mode=S_IFREG|0644, st_size=282624, ...}) = 0
pread64(3, "SQLite format 3\0\20\0\1\1\0@  \0\0\0\4\0\0\0E"..., 4096, 0) = 4096
brk(0x561d67d1e000)                     = 0x561d67d1e000
fcntl(3, F_SETLK, {l_type=F_UNLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
fcntl(3, F_SETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=1073741824, l_len=1}) = 0
fcntl(3, F_SETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=1073741826, l_len=510}) = 0
fcntl(3, F_SETLK, {l_type=F_UNLCK, l_whence=SEEK_SET, l_start=1073741824, l_len=1}) = 0
stat("/home/congee/.leetcode/Problems-journal", 0x7ffcfb98c8f0) = -1 ENOENT (No such file or directory)
pread64(3, "\0\0\0\4\0\0\0E\0\0\0\0\0\0\0\0", 16, 24) = 16
stat("/home/congee/.leetcode/Problems-wal", 0x7ffcfb98c8f0) = -1 ENOENT (No such file or directory)
fstat(3, {st_mode=S_IFREG|0644, st_size=282624, ...}) = 0
fcntl(3, F_SETLK, {l_type=F_UNLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
fcntl(3, F_SETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=1073741824, l_len=1}) = 0
fcntl(3, F_SETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=1073741826, l_len=510}) = 0
fcntl(3, F_SETLK, {l_type=F_UNLCK, l_whence=SEEK_SET, l_start=1073741824, l_len=1}) = 0
stat("/home/congee/.leetcode/Problems-journal", 0x7ffcfb98c8f0) = -1 ENOENT (No such file or directory)
pread64(3, "\0\0\0\4\0\0\0E\0\0\0\0\0\0\0\0", 16, 24) = 16
stat("/home/congee/.leetcode/Problems-wal", 0x7ffcfb98c8f0) = -1 ENOENT (No such file or directory)
fstat(3, {st_mode=S_IFREG|0644, st_size=282624, ...}) = 0
fcntl(3, F_SETLK, {l_type=F_UNLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
statx(AT_FDCWD, "/home/congee/.leetcode", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_ALL, stx_attributes=0, stx_mode=S_IFDIR|0755, stx_size=4096, ...}) = 0
statx(AT_FDCWD, "/home/congee/.leetcode/leetcode.toml", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_ALL, stx_attributes=0, stx_mode=S_IFREG|0644, stx_size=2015, ...}) = 0
openat(AT_FDCWD, "/home/congee/.leetcode/leetcode.toml", O_RDONLY|O_CLOEXEC) = 4
statx(4, "", AT_STATX_SYNC_AS_STAT|AT_EMPTY_PATH, STATX_ALL, {stx_mask=STATX_ALL, stx_attributes=0, stx_mode=S_IFREG|0644, stx_size=2015, ...}) = 0
read(4, "[sys]\ncategories = [\n    'algori"..., 2016) = 2015
read(4, "", 1)                          = 0
close(4)                                = 0
statx(AT_FDCWD, "/home/congee/.leetcode", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_ALL, stx_attributes=0, stx_mode=S_IFDIR|0755, stx_size=4096, ...}) = 0
statx(AT_FDCWD, "/home/congee/.leetcode/leetcode.toml", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_ALL, stx_attributes=0, stx_mode=S_IFREG|0644, stx_size=2015, ...}) = 0
openat(AT_FDCWD, "/home/congee/.leetcode/leetcode.toml", O_RDONLY|O_CLOEXEC) = 4
statx(4, "", AT_STATX_SYNC_AS_STAT|AT_EMPTY_PATH, STATX_ALL, {stx_mask=STATX_ALL, stx_attributes=0, stx_mode=S_IFREG|0644, stx_size=2015, ...}) = 0
read(4, "[sys]\ncategories = [\n    'algori"..., 2016) = 2015
read(4, "", 1)                          = 0
close(4)                                = 0
futex(0x7efc83c8a0c8, FUTEX_WAKE_PRIVATE, 2147483647) = 0
mmap(NULL, 2101248, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x7efc83390000
mprotect(0x7efc83391000, 2097152, PROT_READ|PROT_WRITE) = 0
clone(child_stack=0x7efc8358fbb0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tid=[16346], tls=0x7efc83590700, child_tidptr=0x7efc835909d0) = 16346
futex(0x561d67cdc9b8, FUTEX_WAIT_PRIVATE, 0, NULL) = 0
futex(0x561d67cdc940, FUTEX_WAKE_PRIVATE, 1) = 0
stat("/home/congee/.leetcode/Problems", {st_mode=S_IFREG|0644, st_size=282624, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=282624, ...}) = 0
stat("/home/congee/.leetcode/Problems", {st_mode=S_IFREG|0644, st_size=282624, ...}) = 0
close(3)                                = 0
lstat("/home/congee/.leetcode/Problems", {st_mode=S_IFREG|0644, st_size=282624, ...}) = 0
getpid()                                = 16345
openat(AT_FDCWD, "/home/congee/.leetcode/Problems", O_RDWR|O_CREAT|O_NOFOLLOW|O_CLOEXEC, 0644) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=282624, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=282624, ...}) = 0
stat("/home/congee/.leetcode/Problems", {st_mode=S_IFREG|0644, st_size=282624, ...}) = 0
pread64(3, "SQLite format 3\0\20\0\1\1\0@  \0\0\0\4\0\0\0E"..., 100, 0) = 100
fcntl(3, F_SETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=1073741824, l_len=1}) = 0
fcntl(3, F_SETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=1073741826, l_len=510}) = 0
fcntl(3, F_SETLK, {l_type=F_UNLCK, l_whence=SEEK_SET, l_start=1073741824, l_len=1}) = 0
stat("/home/congee/.leetcode/Problems-journal", 0x7ffcfb98bbc0) = -1 ENOENT (No such file or directory)
stat("/home/congee/.leetcode/Problems-wal", 0x7ffcfb98bbc0) = -1 ENOENT (No such file or directory)
fstat(3, {st_mode=S_IFREG|0644, st_size=282624, ...}) = 0
pread64(3, "SQLite format 3\0\20\0\1\1\0@  \0\0\0\4\0\0\0E"..., 4096, 0) = 4096
fcntl(3, F_SETLK, {l_type=F_UNLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
fcntl(3, F_SETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=1073741824, l_len=1}) = 0
fcntl(3, F_SETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=1073741826, l_len=510}) = 0
fcntl(3, F_SETLK, {l_type=F_UNLCK, l_whence=SEEK_SET, l_start=1073741824, l_len=1}) = 0
stat("/home/congee/.leetcode/Problems-journal", 0x7ffcfb98c620) = -1 ENOENT (No such file or directory)
pread64(3, "\0\0\0\4\0\0\0E\0\0\0\0\0\0\0\0", 16, 24) = 16
stat("/home/congee/.leetcode/Problems-wal", 0x7ffcfb98c620) = -1 ENOENT (No such file or directory)
fstat(3, {st_mode=S_IFREG|0644, st_size=282624, ...}) = 0
pread64(3, "\5\0\0\0A\16{\2\0\0\0\7\17\373\17\366\16{\16\200\16\206\16\214\16\222\16\230\16\236\16\244"..., 4096, 4096) = 4096
pread64(3, "\r\0\0\0\1\0\320\0\0\320\4\230\2r\2\314\3,\3t\0u\0\312\1\21\1m\1\305\2\v"..., 4096, 12288) = 4096
fcntl(3, F_SETLK, {l_type=F_UNLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
stat("/home/congee/.leetcode/Problems", {st_mode=S_IFREG|0644, st_size=282624, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=282624, ...}) = 0
stat("/home/congee/.leetcode/Problems", {st_mode=S_IFREG|0644, st_size=282624, ...}) = 0
close(3)                                = 0
statx(AT_FDCWD, "/home/congee/.leetcode", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_ALL, stx_attributes=0, stx_mode=S_IFDIR|0755, stx_size=4096, ...}) = 0
statx(AT_FDCWD, "/home/congee/.leetcode/leetcode.toml", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_ALL, stx_attributes=0, stx_mode=S_IFREG|0644, stx_size=2015, ...}) = 0
openat(AT_FDCWD, "/home/congee/.leetcode/leetcode.toml", O_RDONLY|O_CLOEXEC) = 3
statx(3, "", AT_STATX_SYNC_AS_STAT|AT_EMPTY_PATH, STATX_ALL, {stx_mask=STATX_ALL, stx_attributes=0, stx_mode=S_IFREG|0644, stx_size=2015, ...}) = 0
read(3, "[sys]\ncategories = [\n    'algori"..., 2016) = 2015
read(3, "", 1)                          = 0
close(3)                                = 0
statx(AT_FDCWD, "/home/congee/.leetcode/code", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_ALL, stx_attributes=0, stx_mode=S_IFDIR|0755, stx_size=4096, ...}) = 0
statx(AT_FDCWD, "/home/congee/.leetcode/code/1.two-sum.cpp", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_ALL, stx_attributes=0, stx_mode=S_IFREG|0644, stx_size=98, ...}) = 0
mmap(NULL, 36864, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x7efc84049000
rt_sigprocmask(SIG_BLOCK, ~[], [], 8)   = 0
clone(child_stack=0x7efc84051ff0, flags=CLONE_VM|CLONE_VFORK|SIGCHLD) = 16347
wait4(16347, NULL, 0, NULL)             = 16347
munmap(0x7efc84049000, 36864)           = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
write(6, "\1", 1)                       = 1
futex(0x7efc835909d0, FUTEX_WAIT, 16346, NULL) = 0
ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0
write(1, "\33[1;31merror:\33[0m No such file o"..., 75) = 75
sigaltstack({ss_sp=NULL, ss_flags=SS_DISABLE, ss_size=8192}, NULL) = 0
munmap(0x7efc84055000, 12288)           = 0
exit_group(0)                           = ?
+++ exited with 0 +++

Test cases files

Thanks for such a nice cli! I find it very helpful.

This is a feature request that could be useful: a test case files. The way I see it is when someone starts to edit any problem - the test cases file is created. That test file is pre-populated with all examples from the problem and could be extended with some custom test cases.

During the test run of the problem if nothing is specified all test cases from the file would be picked up.
This feature does not require any new API for the CLI and fully backwards compatible.

Any thoughts on this?

`leetcode t 85` throws error: expected value at line 1 column 1

Hi, when using the leetcode t .. or leetcode x .., an error was thrown:
error: expected value at line 1 column 1, the full logs are following:

[2020-12-17T03:15:30Z TRACE leetcode_cli::cache] Exec problem filter โ€”โ€” Test or Submit
[2020-12-17T03:15:30Z TRACE leetcode_cli::cache] pre run code...
[2020-12-17T03:15:30Z INFO  leetcode_cli::plugins::leetcode] Sending code to judge...
[2020-12-17T03:15:30Z TRACE leetcode_cli::plugins::leetcode::req] Running leetcode::run_code...
[2020-12-17T03:15:31Z TRACE leetcode_cli::cache] Run veriy recursion...
[2020-12-17T03:15:31Z TRACE leetcode_cli::plugins::leetcode] Verifying result...
[2020-12-17T03:15:31Z TRACE leetcode_cli::plugins::leetcode::req] Running leetcode::verify_result...
[2020-12-17T03:15:31Z DEBUG leetcode_cli::cache] debug resp raw text: 
 "<!DOCTYPE html>\n\n\n\n\n\n\n\n<html>\n  <head>\n    <meta charset=\"utf-8\"><script type=\"text/javascript\">(window.NREUM||(NREUM={})).loader_config={xpid:\"UAQDVFVRGwEAXVlbBAg=\",licenseKey:\"8d5fb92f6e\",applicationID:\"2098939\"};window.NREUM||(NREUM={}),__nr_require=function(t,e,n){function r(n){if(!e[n]){var i=e[n]={exports:{}};t[n][0].call(i.exports,function(e){var i=t[n][1][e];return r(i||e)},i,i.exports)}return e[n].exports}if(\"function\"==typeof __nr_require)return __nr_require;for(var i=0;i<n.length;i++)r(n[i]);return r}({1:[function(t,e,n){function r(t){try{c.console&&console.log(t)}catch(e){}}var i,o=t(\"ee\"),a=t(23),c={};try{i=localStorage.getItem(\"__nr_flags\").split(\",\"),console&&\"function\"==typeof console.log&&(c.console=!0,i.indexOf(\"dev\")!==-1&&(c.dev=!0),i.indexOf(\"nr_dev\")!==-1&&(c.nrDev=!0))}catch(s){}c.nrDev&&o.on(\"internal-error\",function(t){r(t.stack)}),c.dev&&o.on(\"fn-err\",function(t,e,n){r(n.stack)}),c.dev&&(r(\"NR AGENT IN DEVELOPMENT MODE\"),r(\"flags: \"+a(c,function(t,e){return t}).join(\", \")))},{}],2:[function(t,e,n){function r(t,e,n,r,c){try{p?p-=1:i(c||new UncaughtException(t,e,n),!0)}catch(f){try{o(\"ierr\",[f,s.now(),!0])}catch(d){}}return\"function\"==typeof u&&u.apply(this,a(arguments))}function UncaughtException(t,e,n){this.message=t||\"Uncaught error with no additional information\",this.sourceURL=e,this.line=n}function i(t,e){var n=e?null:s.now();o(\"err\",[t,n])}var o=t(\"handle\"),a=t(24),c=t(\"ee\"),s=t(\"loader\"),f=t(\"gos\"),u=window.onerror,d=!1,l=\"nr@seenError\",p=0;s.features.err=!0,t(1),window.onerror=r;try{throw new Error}catch(h){\"stack\"in h&&(t(9),t(8),\"addEventListener\"in window&&t(5),s.xhrWrappable&&t(10),d=!0)}c.on(\"fn-start\",function(t,e,n){d&&(p+=1)}),c.on(\"fn-err\",function(t,e,n){d&&!n[l]&&(f(n,l,function(){return!0}),this.thrown=!0,i(n))}),c.on(\"fn-end\",function(){d&&!this.thrown&&p>0&&(p-=1)}),c.on(\"internal-error\",function(t){o(\"ierr\",[t,s.now(),!0])})},{}],3:[function(t,e,n){t(\"loader\").features.ins=!0},{}],4:[function(t,e,n){function r(t){}if(window.performance&&window.performance.timing&&window.performance.getEntriesByType){var i=t(\"ee\"),o=t(\"handle\"),a=t(9),c=t(8),s=\"learResourceTimings\",f=\"addEventListener\",u=\"resourcetimingbufferfull\",d=\"bstResource\",l=\"resource\",p=\"-start\",h=\"-end\",m=\"fn\"+p,w=\"fn\"+h,v=\"bstTimer\",g=\"pushState\",y=t(\"loader\");y.features.stn=!0,t(7),\"addEventListener\"in window&&t(5);var x=NREUM.o.EV;i.on(m,function(t,e){var n=t[0];n instanceof x&&(this.bstStart=y.now())}),i.on(w,function(t,e){var n=t[0];n instanceof x&&o(\"bst\",[n,e,this.bstStart,y.now()])}),a.on(m,function(t,e,n){this.bstStart=y.now(),this.bstType=n}),a.on(w,function(t,e){o(v,[e,this.bstStart,y.now(),this.bstType])}),c.on(m,function(){this.bstStart=y.now()}),c.on(w,function(t,e){o(v,[e,this.bstStart,y.now(),\"requestAnimationFrame\"])}),i.on(g+p,function(t){this.time=y.now(),this.startPath=location.pathname+location.hash}),i.on(g+h,function(t){o(\"bstHist\",[location.pathname+location.hash,this.startPath,this.time])}),f in window.performance&&(window.performance[\"c\"+s]?window.performance[f](u,function(t){o(d,[window.performance.getEntriesByType(l)]),window.performance[\"c\"+s]()},!1):window.performance[f](\"webkit\"+u,function(t){o(d,[window.performance.getEntriesByType(l)]),window.performance[\"webkitC\"+s]()},!1)),document[f](\"scroll\",r,{passive:!0}),document[f](\"keypress\",r,!1),document[f](\"click\",r,!1)}},{}],5:[function(t,e,n){function r(t){for(var e=t;e&&!e.hasOwnProperty(u);)e=Object.getPrototypeOf(e);e&&i(e)}function i(t){c.inPlace(t,[u,d],\"-\",o)}function o(t,e){return t[1]}var a=t(\"ee\").get(\"events\"),c=t(\"wrap-function\")(a,!0),s=t(\"gos\"),f=XMLHttpRequest,u=\"addEventListener\",d=\"removeEventListener\";e.exports=a,\"getPrototypeOf\"in Object?(r(document),r(window),r(f.prototype)):f.prototype.hasOwnProperty(u)&&(i(window),i(f.prototype)),a.on(u+\"-start\",function(t,e){var n=t[1],r=s(n,\"nr@wrapped\",function(){function t(){if(\"function\"==typeof n.handleEvent)return n.handleEvent.apply(n,arguments)}var e={object:t,\"function\":n}[typeof n];return e?c(e,\"fn-\",null,e.name||\"anonymous\"):n});this.wrapped=t[1]=r}),a.on(d+\"-start\",function(t){t[1]=this.wrapped||t[1]})},{}],6:[function(t,e,n){function r(t,e,n){var r=t[e];\"function\"==typeof r&&(t[e]=function(){var t=o(arguments),e={};i.emit(n+\"before-start\",[t],e);var a;e[m]&&e[m].dt&&(a=e[m].dt);var c=r.apply(this,t);return i.emit(n+\"start\",[t,a],c),c.then(function(t){return i.emit(n+\"end\",[null,t],c),t},function(t){throw i.emit(n+\"end\",[t],c),t})})}var i=t(\"ee\").get(\"fetch\"),o=t(24),a=t(23);e.exports=i;var c=window,s=\"fetch-\",f=s+\"body-\",u=[\"arrayBuffer\",\"blob\",\"json\",\"text\",\"formData\"],d=c.Request,l=c.Response,p=c.fetch,h=\"prototype\",m=\"nr@context\";d&&l&&p&&(a(u,function(t,e){r(d[h],e,f),r(l[h],e,f)}),r(c,\"fetch\",s),i.on(s+\"end\",function(t,e){var n=this;if(e){var r=e.headers.get(\"content-length\");null!==r&&(n.rxSize=r),i.emit(s+\"done\",[null,e],n)}else i.emit(s+\"done\",[t],n)}))},{}],7:[function(t,e,n){var r=t(\"ee\").get(\"history\"),i=t(\"wrap-function\")(r);e.exports=r;var o=window.history&&window.history.constructor&&window.history.constructor.prototype,a=window.history;o&&o.pushState&&o.replaceState&&(a=o),i.inPlace(a,[\"pushState\",\"replaceState\"],\"-\")},{}],8:[function(t,e,n){var r=t(\"ee\").get(\"raf\"),i=t(\"wrap-function\")(r),o=\"equestAnimationFrame\";e.exports=r,i.inPlace(window,[\"r\"+o,\"mozR\"+o,\"webkitR\"+o,\"msR\"+o],\"raf-\"),r.on(\"raf-start\",function(t){t[0]=i(t[0],\"fn-\")})},{}],9:[function(t,e,n){function r(t,e,n){t[0]=a(t[0],\"fn-\",null,n)}function i(t,e,n){this.method=n,this.timerDuration=isNaN(t[1])?0:+t[1],t[0]=a(t[0],\"fn-\",this,n)}var o=t(\"ee\").get(\"timer\"),a=t(\"wrap-function\")(o),c=\"setTimeout\",s=\"setInterval\",f=\"clearTimeout\",u=\"-start\",d=\"-\";e.exports=o,a.inPlace(window,[c,\"setImmediate\"],c+d),a.inPlace(window,[s],s+d),a.inPlace(window,[f,\"clearImmediate\"],f+d),o.on(s+u,r),o.on(c+u,i)},{}],10:[function(t,e,n){function r(t,e){d.inPlace(e,[\"onreadystatechange\"],\"fn-\",c)}function i(){var t=this,e=u.context(t);t.readyState>3&&!e.resolved&&(e.resolved=!0,u.emit(\"xhr-resolved\",[],t)),d.inPlace(t,g,\"fn-\",c)}function o(t){y.push(t),h&&(b?b.then(a):w?w(a):(E=-E,R.data=E))}function a(){for(var t=0;t<y.length;t++)r([],y[t]);y.length&&(y=[])}function c(t,e){return e}function s(t,e){for(var n in t)e[n]=t[n];return e}t(5);var f=t(\"ee\"),u=f.get(\"xhr\"),d=t(\"wrap-function\")(u),l=NREUM.o,p=l.XHR,h=l.MO,m=l.PR,w=l.SI,v=\"readystatechange\",g=[\"onload\",\"onerror\",\"onabort\",\"onloadstart\",\"onloadend\",\"onprogress\",\"ontimeout\"],y=[];e.exports=u;var x=window.XMLHttpRequest=function(t){var e=new p(t);try{u.emit(\"new-xhr\",[e],e),e.addEventListener(v,i,!1)}catch(n){try{u.emit(\"internal-error\",[n])}catch(r){}}return e};if(s(p,x),x.prototype=p.prototype,d.inPlace(x.prototype,[\"open\",\"send\"],\"-xhr-\",c),u.on(\"send-xhr-start\",function(t,e){r(t,e),o(e)}),u.on(\"open-xhr-start\",r),h){var b=m&&m.resolve();if(!w&&!m){var E=1,R=document.createTextNode(E);new h(a).observe(R,{characterData:!0})}}else f.on(\"fn-end\",function(t){t[0]&&t[0].type===v||a()})},{}],11:[function(t,e,n){function r(t){if(!c(t))return null;var e=window.NREUM;if(!e.loader_config)return null;var n=(e.loader_config.accountID||\"\").toString()||null,r=(e.loader_config.agentID||\"\").toString()||null,f=(e.loader_config.trustKey||\"\").toString()||null;if(!n||!r)return null;var h=p.generateSpanId(),m=p.generateTraceId(),w=Date.now(),v={spanId:h,traceId:m,timestamp:w};return(t.sameOrigin||s(t)&&l())&&(v.traceContextParentHeader=i(h,m),v.traceContextStateHeader=o(h,w,n,r,f)),(t.sameOrigin&&!u()||!t.sameOrigin&&s(t)&&d())&&(v.newrelicHeader=a(h,m,w,n,r,f)),v}function i(t,e){return\"00-\"+e+\"-\"+t+\"-01\"}function o(t,e,n,r,i){var o=0,a=\"\",c=1,s=\"\",f=\"\";return i+\"@nr=\"+o+\"-\"+c+\"-\"+n+\"-\"+r+\"-\"+t+\"-\"+a+\"-\"+s+\"-\"+f+\"-\"+e}function a(t,e,n,r,i,o){var a=\"btoa\"in window&&\"function\"==typeof window.btoa;if(!a)return null;var c={v:[0,1],d:{ty:\"Browser\",ac:r,ap:i,id:t,tr:e,ti:n}};return o&&r!==o&&(c.d.tk=o),btoa(JSON.stringify(c))}function c(t){return f()&&s(t)}function s(t){var e=!1,n={};if(\"init\"in NREUM&&\"distributed_tracing\"in NREUM.init&&(n=NREUM.init.distributed_tracing),t.sameOrigin)e=!0;else if(n.allowed_origins instanceof Array)for(var r=0;r<n.allowed_origins.length;r++){var i=h(n.allowed_origins[r]);if(t.hostname===i.hostname&&t.protocol===i.protocol&&t.port===i.port){e=!0;break}}return e}function f(){return\"init\"in NREUM&&\"distributed_tracing\"in NREUM.init&&!!NREUM.init.distributed_tracing.enabled}function u(){return\"init\"in NREUM&&\"distributed_tracing\"in NREUM.init&&!!NREUM.init.distributed_tracing.exclude_newrelic_header}function d(){return\"init\"in NREUM&&\"distributed_tracing\"in NREUM.init&&NREUM.init.distributed_tracing.cors_use_newrelic_header!==!1}function l(){return\"init\"in NREUM&&\"distributed_tracing\"in NREUM.init&&!!NREUM.init.distributed_tracing.cors_use_tracecontext_headers}var p=t(20),h=t(13);e.exports={generateTracePayload:r,shouldGenerateTrace:c}},{}],12:[function(t,e,n){function r(t){var e=this.params,n=this.metrics;if(!this.ended){this.ended=!0;for(var r=0;r<l;r++)t.removeEventListener(d[r],this.listener,!1);e.aborted||(n.duration=a.now()-this.startTime,this.loadCaptureCalled||4!==t.readyState?null==e.status&&(e.status=0):o(this,t),n.cbTime=this.cbTime,u.emit(\"xhr-done\",[t],t),c(\"xhr\",[e,n,this.startTime]))}}function i(t,e){var n=s(e),r=t.params;r.host=n.hostname+\":\"+n.port,r.pathname=n.pathname,t.parsedOrigin=s(e),t.sameOrigin=t.parsedOrigin.sameOrigin}function o(t,e){t.params.status=e.status;var n=w(e,t.lastSize);if(n&&(t.metrics.rxSize=n),t.sameOrigin){var r=e.getResponseHeader(\"X-NewRelic-App-Data\");r&&(t.params.cat=r.split(\", \").pop())}t.loadCaptureCalled=!0}var a=t(\"loader\");if(a.xhrWrappable){var c=t(\"handle\"),s=t(13),f=t(11).generateTracePayload,u=t(\"ee\"),d=[\"load\",\"error\",\"abort\",\"timeout\"],l=d.length,p=t(\"id\"),h=t(17),m=t(16),w=t(14),v=window.XMLHttpRequest;a.features.xhr=!0,t(10),t(6),u.on(\"new-xhr\",function(t){var e=this;e.totalCbs=0,e.called=0,e.cbTime=0,e.end=r,e.ended=!1,e.xhrGuids={},e.lastSize=null,e.loadCaptureCalled=!1,t.addEventListener(\"load\",function(n){o(e,t)},!1),h&&(h>34||h<10)||window.opera||t.addEventListener(\"progress\",function(t){e.lastSize=t.loaded},!1)}),u.on(\"open-xhr-start\",function(t){this.params={method:t[0]},i(this,t[1]),this.metrics={}}),u.on(\"open-xhr-end\",function(t,e){\"loader_config\"in NREUM&&\"xpid\"in NREUM.loader_config&&this.sameOrigin&&e.setRequestHeader(\"X-NewRelic-ID\",NREUM.loader_config.xpid);var n=f(this.parsedOrigin);if(n){var r=!1;n.newrelicHeader&&(e.setRequestHeader(\"newrelic\",n.newrelicHeader),r=!0),n.traceContextParentHeader&&(e.setRequestHeader(\"traceparent\",n.traceContextParentHeader),n.traceContextStateHeader&&e.setRequestHeader(\"tracestate\",n.traceContextStateHeader),r=!0),r&&(this.dt=n)}}),u.on(\"send-xhr-start\",function(t,e){var n=this.metrics,r=t[0],i=this;if(n&&r){var o=m(r);o&&(n.txSize=o)}this.startTime=a.now(),this.listener=function(t){try{\"abort\"!==t.type||i.loadCaptureCalled||(i.params.aborted=!0),(\"load\"!==t.type||i.called===i.totalCbs&&(i.onloadCalled||\"function\"!=typeof e.onload))&&i.end(e)}catch(n){try{u.emit(\"internal-error\",[n])}catch(r){}}};for(var c=0;c<l;c++)e.addEventListener(d[c],this.listener,!1)}),u.on(\"xhr-cb-time\",function(t,e,n){this.cbTime+=t,e?this.onloadCalled=!0:this.called+=1,this.called!==this.totalCbs||!this.onloadCalled&&\"function\"==typeof n.onload||this.end(n)}),u.on(\"xhr-load-added\",function(t,e){var n=\"\"+p(t)+!!e;this.xhrGuids&&!this.xhrGuids[n]&&(this.xhrGuids[n]=!0,this.totalCbs+=1)}),u.on(\"xhr-load-removed\",function(t,e){var n=\"\"+p(t)+!!e;this.xhrGuids&&this.xhrGuids[n]&&(delete this.xhrGuids[n],this.totalCbs-=1)}),u.on(\"addEventListener-end\",function(t,e){e instanceof v&&\"load\"===t[0]&&u.emit(\"xhr-load-added\",[t[1],t[2]],e)}),u.on(\"removeEventListener-end\",function(t,e){e instanceof v&&\"load\"===t[0]&&u.emit(\"xhr-load-removed\",[t[1],t[2]],e)}),u.on(\"fn-start\",function(t,e,n){e instanceof v&&(\"onload\"===n&&(this.onload=!0),(\"load\"===(t[0]&&t[0].type)||this.onload)&&(this.xhrCbStart=a.now()))}),u.on(\"fn-end\",function(t,e){this.xhrCbStart&&u.emit(\"xhr-cb-time\",[a.now()-this.xhrCbStart,this.onload,e],e)}),u.on(\"fetch-before-start\",function(t){function e(t,e){var n=!1;return e.newrelicHeader&&(t.set(\"newrelic\",e.newrelicHeader),n=!0),e.traceContextParentHeader&&(t.set(\"traceparent\",e.traceContextParentHeader),e.traceContextStateHeader&&t.set(\"tracestate\",e.traceContextStateHeader),n=!0),n}var n,r=t[1]||{};\"string\"==typeof t[0]?n=t[0]:t[0]&&t[0].url&&(n=t[0].url),n&&(this.parsedOrigin=s(n),this.sameOrigin=this.parsedOrigin.sameOrigin);var i=f(this.parsedOrigin);if(i&&(i.newrelicHeader||i.traceContextParentHeader))if(\"string\"==typeof t[0]){var o={};for(var a in r)o[a]=r[a];o.headers=new Headers(r.headers||{}),e(o.headers,i)&&(this.dt=i),t.length>1?t[1]=o:t.push(o)}else t[0]&&t[0].headers&&e(t[0].headers,i)&&(this.dt=i)})}},{}],13:[function(t,e,n){var r={};e.exports=function(t){if(t in r)return r[t];var e=document.createElement(\"a\"),n=window.location,i={};e.href=t,i.port=e.port;var o=e.href.split(\"://\");!i.port&&o[1]&&(i.port=o[1].split(\"/\")[0].split(\"@\").pop().split(\":\")[1]),i.port&&\"0\"!==i.port||(i.port=\"https\"===o[0]?\"443\":\"80\"),i.hostname=e.hostname||n.hostname,i.pathname=e.pathname,i.protocol=o[0],\"/\"!==i.pathname.charAt(0)&&(i.pathname=\"/\"+i.pathname);var a=!e.protocol||\":\"===e.protocol||e.protocol===n.protocol,c=e.hostname===document.domain&&e.port===n.port;return i.sameOrigin=a&&(!e.hostname||c),\"/\"===i.pathname&&(r[t]=i),i}},{}],14:[function(t,e,n){function r(t,e){var n=t.responseType;return\"json\"===n&&null!==e?e:\"arraybuffer\"===n||\"blob\"===n||\"json\"===n?i(t.response):\"text\"===n||\"\"===n||void 0===n?i(t.responseText):void 0}var i=t(16);e.exports=r},{}],15:[function(t,e,n){function r(){}function i(t,e,n){return function(){return o(t,[f.now()].concat(c(arguments)),e?null:this,n),e?void 0:this}}var o=t(\"handle\"),a=t(23),c=t(24),s=t(\"ee\").get(\"tracer\"),f=t(\"loader\"),u=NREUM;\"undefined\"==typeof window.newrelic&&(newrelic=u);var d=[\"setPageViewName\",\"setCustomAttribute\",\"setErrorHandler\",\"finished\",\"addToTrace\",\"inlineHit\",\"addRelease\"],l=\"api-\",p=l+\"ixn-\";a(d,function(t,e){u[e]=i(l+e,!0,\"api\")}),u.addPageAction=i(l+\"addPageAction\",!0),u.setCurrentRouteName=i(l+\"routeName\",!0),e.exports=newrelic,u.interaction=function(){return(new r).get()};var h=r.prototype={createTracer:function(t,e){var n={},r=this,i=\"function\"==typeof e;return o(p+\"tracer\",[f.now(),t,n],r),function(){if(s.emit((i?\"\":\"no-\")+\"fn-start\",[f.now(),r,i],n),i)try{return e.apply(this,arguments)}catch(t){throw s.emit(\"fn-err\",[arguments,this,t],n),t}finally{s.emit(\"fn-end\",[f.now()],n)}}}};a(\"actionText,setName,setAttribute,save,ignore,onEnd,getContext,end,get\".split(\",\"),function(t,e){h[e]=i(p+e)}),newrelic.noticeError=function(t,e){\"string\"==typeof t&&(t=new Error(t)),o(\"err\",[t,f.now(),!1,e])}},{}],16:[function(t,e,n){e.exports=function(t){if(\"string\"==typeof t&&t.length)return t.length;if(\"object\"==typeof t){if(\"undefined\"!=typeof ArrayBuffer&&t instanceof ArrayBuffer&&t.byteLength)return t.byteLength;if(\"undefined\"!=typeof Blob&&t instanceof Blob&&t.size)return t.size;if(!(\"undefined\"!=typeof FormData&&t instanceof FormData))try{return JSON.stringify(t).length}catch(e){return}}}},{}],17:[function(t,e,n){var r=0,i=navigator.userAgent.match(/Firefox[\\/\\s](\\d+\\.\\d+)/);i&&(r=+i[1]),e.exports=r},{}],18:[function(t,e,n){function r(){return c.exists&&performance.now?Math.round(performance.now()):(o=Math.max((new Date).getTime(),o))-a}function i(){return o}var o=(new Date).getTime(),a=o,c=t(25);e.exports=r,e.exports.offset=a,e.exports.getLastTimestamp=i},{}],19:[function(t,e,n){function r(t,e){var n=t.getEntries();n.forEach(function(t){\"first-paint\"===t.name?d(\"timing\",[\"fp\",Math.floor(t.startTime)]):\"first-contentful-paint\"===t.name&&d(\"timing\",[\"fcp\",Math.floor(t.startTime)])})}function i(t,e){var n=t.getEntries();n.length>0&&d(\"lcp\",[n[n.length-1]])}function o(t){t.getEntries().forEach(function(t){t.hadRecentInput||d(\"cls\",[t])})}function a(t){if(t instanceof h&&!w){var e=Math.round(t.timeStamp),n={type:t.type};e<=l.now()?n.fid=l.now()-e:e>l.offset&&e<=Date.now()?(e-=l.offset,n.fid=l.now()-e):e=l.now(),w=!0,d(\"timing\",[\"fi\",e,n])}}function c(t){d(\"pageHide\",[l.now(),t])}if(!(\"init\"in NREUM&&\"page_view_timing\"in NREUM.init&&\"enabled\"in NREUM.init.page_view_timing&&NREUM.init.page_view_timing.enabled===!1)){var s,f,u,d=t(\"handle\"),l=t(\"loader\"),p=t(22),h=NREUM.o.EV;if(\"PerformanceObserver\"in window&&\"function\"==typeof window.PerformanceObserver){s=new PerformanceObserver(r);try{s.observe({entryTypes:[\"paint\"]})}catch(m){}f=new PerformanceObserver(i);try{f.observe({entryTypes:[\"largest-contentful-paint\"]})}catch(m){}u=new PerformanceObserver(o);try{u.observe({type:\"layout-shift\",buffered:!0})}catch(m){}}if(\"addEventListener\"in document){var w=!1,v=[\"click\",\"keydown\",\"mousedown\",\"pointerdown\",\"touchstart\"];v.forEach(function(t){document.addEventListener(t,a,!1)})}p(c)}},{}],20:[function(t,e,n){function r(){function t(){return e?15&e[n++]:16*Math.random()|0}var e=null,n=0,r=window.crypto||window.msCrypto;r&&r.getRandomValues&&(e=r.getRandomValues(new Uint8Array(31)));for(var i,o=\"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\",a=\"\",c=0;c<o.length;c++)i=o[c],\"x\"===i?a+=t().toString(16):\"y\"===i?(i=3&t()|8,a+=i.toString(16)):a+=i;return a}function i(){return a(16)}function o(){return a(32)}function a(t){function e(){return n?15&n[r++]:16*Math.random()|0}var n=null,r=0,i=window.crypto||window.msCrypto;i&&i.getRandomValues&&Uint8Array&&(n=i.getRandomValues(new Uint8Array(31)));for(var o=[],a=0;a<t;a++)o.push(e().toString(16));return o.join(\"\")}e.exports={generateUuid:r,generateSpanId:i,generateTraceId:o}},{}],21:[function(t,e,n){function r(t,e){if(!i)return!1;if(t!==i)return!1;if(!e)return!0;if(!o)return!1;for(var n=o.split(\".\"),r=e.split(\".\"),a=0;a<r.length;a++)if(r[a]!==n[a])return!1;return!0}var i=null,o=null,a=/Version\\/(\\S+)\\s+Safari/;if(navigator.userAgent){var c=navigator.userAgent,s=c.match(a);s&&c.indexOf(\"Chrome\")===-1&&c.indexOf(\"Chromium\")===-1&&(i=\"Safari\",o=s[1])}e.exports={agent:i,version:o,match:r}},{}],22:[function(t,e,n){function r(t){function e(){t(a&&document[a]?document[a]:document[i]?\"hidden\":\"visible\")}\"addEventListener\"in document&&o&&document.addEventListener(o,e,!1)}e.exports=r;var i,o,a;\"undefined\"!=typeof document.hidden?(i=\"hidden\",o=\"visibilitychange\",a=\"visibilityState\"):\"undefined\"!=typeof document.msHidden?(i=\"msHidden\",o=\"msvisibilitychange\"):\"undefined\"!=typeof document.webkitHidden&&(i=\"webkitHidden\",o=\"webkitvisibilitychange\",a=\"webkitVisibilityState\")},{}],23:[function(t,e,n){function r(t,e){var n=[],r=\"\",o=0;for(r in t)i.call(t,r)&&(n[o]=e(r,t[r]),o+=1);return n}var i=Object.prototype.hasOwnProperty;e.exports=r},{}],24:[function(t,e,n){function r(t,e,n){e||(e=0),\"undefined\"==typeof n&&(n=t?t.length:0);for(var r=-1,i=n-e||0,o=Array(i<0?0:i);++r<i;)o[r]=t[e+r];return o}e.exports=r},{}],25:[function(t,e,n){e.exports={exists:\"undefined\"!=typeof window.performance&&window.performance.timing&&\"undefined\"!=typeof window.performance.timing.navigationStart}},{}],ee:[function(t,e,n){function r(){}function i(t){function e(t){return t&&t instanceof r?t:t?s(t,c,o):o()}function n(n,r,i,o){if(!l.aborted||o){t&&t(n,r,i);for(var a=e(i),c=m(n),s=c.length,f=0;f<s;f++)c[f].apply(a,r);var d=u[y[n]];return d&&d.push([x,n,r,a]),a}}function p(t,e){g[t]=m(t).concat(e)}function h(t,e){var n=g[t];if(n)for(var r=0;r<n.length;r++)n[r]===e&&n.splice(r,1)}function m(t){return g[t]||[]}function w(t){return d[t]=d[t]||i(n)}function v(t,e){f(t,function(t,n){e=e||\"feature\",y[n]=e,e in u||(u[e]=[])})}var g={},y={},x={on:p,addEventListener:p,removeEventListener:h,emit:n,get:w,listeners:m,context:e,buffer:v,abort:a,aborted:!1};return x}function o(){return new r}function a(){(u.api||u.feature)&&(l.aborted=!0,u=l.backlog={})}var c=\"nr@context\",s=t(\"gos\"),f=t(23),u={},d={},l=e.exports=i();l.backlog=u},{}],gos:[function(t,e,n){function r(t,e,n){if(i.call(t,e))return t[e];var r=n();if(Object.defineProperty&&Object.keys)try{return Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!1}),r}catch(o){}return t[e]=r,r}var i=Object.prototype.hasOwnProperty;e.exports=r},{}],handle:[function(t,e,n){function r(t,e,n,r){i.buffer([t],r),i.emit(t,e,n)}var i=t(\"ee\").get(\"handle\");e.exports=r,r.ee=i},{}],id:[function(t,e,n){function r(t){var e=typeof t;return!t||\"object\"!==e&&\"function\"!==e?-1:t===window?0:a(t,o,function(){return i++})}var i=1,o=\"nr@id\",a=t(\"gos\");e.exports=r},{}],loader:[function(t,e,n){function r(){if(!b++){var t=x.info=NREUM.info,e=l.getElementsByTagName(\"script\")[0];if(setTimeout(f.abort,3e4),!(t&&t.licenseKey&&t.applicationID&&e))return f.abort();s(g,function(e,n){t[e]||(t[e]=n)});var n=a();c(\"mark\",[\"onload\",n+x.offset],null,\"api\"),c(\"timing\",[\"load\",n]);var r=l.createElement(\"script\");r.src=\"https://\"+t.agent,e.parentNode.insertBefore(r,e)}}function i(){\"complete\"===l.readyState&&o()}function o(){c(\"mark\",[\"domContent\",a()+x.offset],null,\"api\")}var a=t(18),c=t(\"handle\"),s=t(23),f=t(\"ee\"),u=t(21),d=window,l=d.document,p=\"addEventListener\",h=\"attachEvent\",m=d.XMLHttpRequest,w=m&&m.prototype;NREUM.o={ST:setTimeout,SI:d.setImmediate,CT:clearTimeout,XHR:m,REQ:d.Request,EV:d.Event,PR:d.Promise,MO:d.MutationObserver};var v=\"\"+location,g={beacon:\"bam.nr-data.net\",errorBeacon:\"bam.nr-data.net\",agent:\"js-agent.newrelic.com/nr-1184.min.js\"},y=m&&w&&w[p]&&!/CriOS/.test(navigator.userAgent),x=e.exports={offset:a.getLastTimestamp(),now:a,origin:v,features:{},xhrWrappable:y,userAgent:u};t(15),t(19),l[p]?(l[p](\"DOMContentLoaded\",o,!1),d[p](\"load\",r,!1)):(l[h](\"onreadystatechange\",i),d[h](\"onload\",r)),c(\"mark\",[\"firstbyte\",a.getLastTimestamp()],null,\"api\");var b=0},{}],\"wrap-function\":[function(t,e,n){function r(t){return!(t&&t instanceof Function&&t.apply&&!t[a])}var i=t(\"ee\"),o=t(24),a=\"nr@original\",c=Object.prototype.hasOwnProperty,s=!1;e.exports=function(t,e){function n(t,e,n,i){function nrWrapper(){var r,a,c,s;try{a=this,r=o(arguments),c=\"function\"==typeof n?n(r,a):n||{}}catch(f){l([f,\"\",[r,a,i],c])}u(e+\"start\",[r,a,i],c);try{return s=t.apply(a,r)}catch(d){throw u(e+\"err\",[r,a,d],c),d}finally{u(e+\"end\",[r,a,s],c)}}return r(t)?t:(e||(e=\"\"),nrWrapper[a]=t,d(t,nrWrapper),nrWrapper)}function f(t,e,i,o){i||(i=\"\");var a,c,s,f=\"-\"===i.charAt(0);for(s=0;s<e.length;s++)c=e[s],a=t[c],r(a)||(t[c]=n(a,f?c+i:i,o,c))}function u(n,r,i){if(!s||e){var o=s;s=!0;try{t.emit(n,r,i,e)}catch(a){l([a,n,r,i])}s=o}}function d(t,e){if(Object.defineProperty&&Object.keys)try{var n=Object.keys(t);return n.forEach(function(n){Object.defineProperty(e,n,{get:function(){return t[n]},set:function(e){return t[n]=e,e}})}),e}catch(r){l([r])}for(var i in t)c.call(t,i)&&(e[i]=t[i]);return e}function l(e){try{t.emit(\"internal-error\",e)}catch(n){}}return t||(t=i),n.inPlace=f,n.flag=a,n}},{}]},{},[\"loader\",2,12,4,3]);</script><script type=\"text/javascript\">window.NREUM||(NREUM={});NREUM.info={\"beacon\":\"bam-cell.nr-data.net\",\"errorBeacon\":\"bam-cell.nr-data.net\",\"licenseKey\":\"8d5fb92f6e\",\"applicationID\":\"2098939\",\"transactionName\":\"ZwMAYEdSCktRWxZRXV5JJEFbUBBRX1ZNXFhRCAVbG0UNXUdLTFxXVgcXWEFAXkhRXwdnXF8SPVJaRgpc\",\"queueTime\":0,\"applicationTime\":182,\"agent\":\"\"}</script>\n    <title>Page Not Found - LeetCode</title>\n    <meta property=\"og:title\" content=\"Page Not Found - LeetCode\" />\n\n    \n    <meta content=\'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover\' name=\'viewport\' />\n    \n    <meta name=\"description\" content=\"Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.\" />\n    \n    <meta property=\"og:image\" content=\"/static/images/LeetCode_Sharing.png\" />\n    <meta property=\"og:description\" content=\"Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.\" />\n\n    \n\n    <link rel=\"apple-touch-icon\" sizes=\"57x57\" href=\"/apple-touch-icon-57x57.png\" />\n    <link rel=\"apple-touch-icon\" sizes=\"60x60\" href=\"/apple-touch-icon-60x60.png\" />\n    <link rel=\"apple-touch-icon\" sizes=\"72x72\" href=\"/apple-touch-icon-72x72.png\" />\n    <link rel=\"apple-touch-icon\" sizes=\"76x76\" href=\"/apple-touch-icon-76x76.png\" />\n    <link rel=\"apple-touch-icon\" sizes=\"114x114\" href=\"/apple-touch-icon-114x114.png\" />\n    <link rel=\"apple-touch-icon\" sizes=\"120x120\" href=\"/apple-touch-icon-120x120.png\" />\n    <link rel=\"apple-touch-icon\" sizes=\"144x144\" href=\"/apple-touch-icon-144x144.png\" />\n    <link rel=\"apple-touch-icon\" sizes=\"152x152\" href=\"/apple-touch-icon-152x152.png\" />\n    <link rel=\"apple-touch-icon\" sizes=\"180x180\" href=\"/apple-touch-icon-180x180.png\" />\n    <link rel=\"icon\" type=\"image/png\" href=\"/favicon-16x16.png\" sizes=\"16x16\" />\n    <link rel=\"icon\" type=\"image/png\" href=\"/favicon-32x32.png\" sizes=\"32x32\" />\n    <link rel=\"icon\" type=\"image/png\" href=\"/favicon-96x96.png\" sizes=\"96x96\" />\n    <link rel=\"icon\" type=\"image/png\" href=\"/favicon-160x160.png\" sizes=\"160x160\" />\n    <link rel=\"icon\" type=\"image/png\" href=\"/favicon-192x192.png\" sizes=\"192x192\" />\n    <meta name=\"application-name\" content=\"LeetCode\"/>\n    <meta name=\"msapplication-TileColor\" content=\"#da532c\" />\n    <meta name=\"msapplication-TileImage\" content=\"/mstile-144x144.png\" />\n\n    \n\n    <script>\n  (function(i,s,o,g,r,a,m){i[\'GoogleAnalyticsObject\']=r;i[r]=i[r]||function(){\n  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s\n  .createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m\n  .parentNode.insertBefore(a,m)})(window,document,\'script\',\n  \'//www.google-analytics.com/analytics.js\',\'ga\');\n\n  ga(\'create\', \'UA-159258186-1\', \'leetcode.com\', { userId: 1583918, sampleRate: 75 });\n  ga(\'set\', {\'dimension1\': \'false\', \'dimension2\': \'1583918\'});\n  ga(\'require\', \'displayfeatures\');\n  ga(\'send\', \'pageview\');\n</script>\n\n\n    <link href=\"/static/bootstrap/dist/css/bootstrap.min.css?v=3.3.7\" rel=\"stylesheet\">\n    <link href=\"/static/font-awesome/css/font-awesome.min.css?cache_version=2\" rel=\"stylesheet\">\n    <link href=\"/static/bootstrap-table/dist/bootstrap-table.min.css\" rel=\"stylesheet\" />\n\n     \n\n    <link rel=\"stylesheet\" href=\"/static/CACHE/css/output.b60383757e52.css\" type=\"text/css\">\n\n    \n\n    \n    \n<link rel=\"stylesheet\" href=\"/static/CACHE/css/output.35273db4015b.css\" type=\"text/css\">\n\n\n    <script src=\"/static/CACHE/js/output.0ff5509473f6.js\"></script>\n    <script src=\"/static/jquery/dist/jquery.min.js?v=3.3.1\"></script>\n    <script>window.jQuery || document.write(\"<script src=\\\"https://code.jquery.com/jquery-3.3.1.min.js\\\">\\x3C/script>\")</script>\n    <script src=\"/static/jquery.cookie/jquery.cookie.js\"></script>\n    <script src=\"/static/jquery-sticky/jquery.sticky.js\"></script>\n    <script src=\"/static/clipboard/dist/clipboard.min.js\"></script>\n    <script src=\"/static/sweetalert2/dist/sweetalert2.min.js\"></script>\n    <script>\n      $(document).ready(function(){\n        $(\'.sticky\').sticky({topSpacing:0});\n      });\n\n      \n      \n      \n      window.LeetCodeData = {\n        features: {\n          questionTranslation: false,\n          subscription: true,\n          signUp: true,\n          chinaProblemDiscuss: false,\n          enableSharedWorker: true,\n          enableChannels: true,\n          enableDangerZone: true,\n          enableCnJobs: false,\n          enableRecaptchaV3: true,\n          enableIndiaPricing: true,\n          enableReferralDiscount: true,\n          maxTimeTravelTicketCount: 3,\n        },\n        regionInfo: \"US\",\n        userStatus: {\n          isSignedIn: true,\n          optedIn:  true ,\n          isPremium: false,\n          isAdmin:  false ,\n          isStaff:  false ,\n          isTranslator:  false ,\n          isSuperuser:  false ,\n          request_region: \'CN\',\n          region: \'\',\n          plan: \'None\',\n          countryCode: \'CN\',\n          permissions: [],\n          \n            realName: \'\',\n            username: \'Innobit\',\n            userSlug: \'Innobit\',\n            avatar: \'https://www.gravatar.com/avatar/a335b5c71ce4dd1a9455fc8d2c81813d.png?s=200\',\n            numUnreadNotifications: 0,\n            lastModified: 1607926592,\n          \n          \n        },\n        chinaURL: \"https://leetcode-cn.com\",\n        websocketUrl: \"wss://sockets.leetcode.com/ws/\",\n        recaptchaKey: \"6LdBpsIUAAAAAKAYWjZfIpn4cJHVIk_tsmxpl7cz\",\n        recaptchaKeyV2: \"6LdBX8MUAAAAAAI4aZHi1C59OJizaJTvPNvWH2wz\",\n        \n        navbar: {\n          \n            loginSocial: [{\"id\": \"linkedin_oauth2\", \"login_url\": \"/accounts/linkedin_oauth2/login/\"}, {\"id\": \"google\", \"login_url\": \"/accounts/google/login/\"}, {\"id\": \"github\", \"login_url\": \"/accounts/github/login/\"}, {\"id\": \"facebook\", \"login_url\": \"/accounts/facebook/login/\"}],\n          \n          loginNext: undefined,\n          subscription: true,\n          mi: true,\n          contest: true,\n          discuss: true,\n          store: true,\n          translate: false,\n          identity:  \"\" ,\n        },\n      };\n    </script>\n    <script src=\"/static/angular/angular.min.js\"></script>\n    <script src=\"/static/jquery-ui-dist/jquery-ui.min.js\"></script>\n    <script src=\"/static/noty/lib/noty.min.js\"></script>\n    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->\n    <!-- WARNING: Respond.js doesn\'t work if you view the page via file:// -->\n    <!--[if lt IE 9]>\n      <script src=\"/static/html5shiv/dist/html5shiv.min.js\"></script>\n      <script src=\"/static/respond.js/dest/respond.min.js\"></script>\n    <![endif]-->\n\n    \n  </head>\n  <body>\n    <script src=\"/static/bootstrap/dist/js/bootstrap.min.js?v=3.3.7\"></script>\n    <script src=\"/static/bootstrap-table/dist/bootstrap-table.min.js\"></script>\n    <script src=\"/static/CACHE/js/output.ee2b7fc628e3.js\"></script>\n\n    <script type=\"text/javascript\" src=\"https://assets.leetcode.com/static_assets/public/webpack_bundles/runtime.87724bff8.js\" ></script>\n    <script type=\"text/javascript\" src=\"https://assets.leetcode.com/static_assets/public/webpack_bundles/common/global.5b936f50e.js\" ></script>\n    <script type=\"text/javascript\" src=\"https://assets.leetcode.com/static_assets/public/webpack_bundles/common/styles/index.ec538f962.js\" ></script>\n    <script type=\"text/javascript\" src=\"https://assets.leetcode.com/static_assets/public/webpack_bundles/vendor-libs.2963f9cf9.js\" ></script>\n    <script type=\"text/javascript\" src=\"https://assets.leetcode.com/static_assets/public/webpack_bundles/common-libs.803c04608.js\" ></script>\n    <script type=\"text/javascript\" src=\"https://assets.leetcode.com/static_assets/public/webpack_bundles/new-libs.a4e6ab10b.js\" ></script>\n\n    \n     \n    \n    <aside id=\"region_switcher\" class=\"hide\">\n      <div class=\"container\">\n        <button class=\"btn btn-link pull-right close-btn\" onclick=\"closeRegion()\">\n          <i class=\"fa fa-times-circle\" aria-hidden=\"true\"></i>\n        </button>\n        <div class=\"inner\">\n          <a href=\"https://leetcode-cn.com\">\n            <img class=\"country-flag\" src=\"/static/images/region/cn.svg\">\n          </a>\n          <div class=\"content\">\n            <div class=\"title\">ไฝฟ็”จ <a href=\"https://leetcode-cn.com\">ๅŠ›ๆ‰ฃ๏ผˆLeetCode๏ผ‰**</a>๏ผŒๆฅ่Žทๅพ—้€‚ๅˆๆ‚จ็š„ๅ†…ๅฎนไปฅๅŠๆœ€ไฝณ็š„็”จๆˆทไฝ“้ชŒใ€‚</div>\n            <div class=\"user-actions\">\n              <a href=\"https://leetcode-cn.com/submissions/\">ๅณๅˆปๅ‰ๅพ€</a>\n              \n              &nbsp; <span class=\"sep-line\">|</span> &nbsp;\n              <a href=\"/accounts/transfer2china/\" id=\"trans-acct\">\n                <span class=\"hidden-xs\">ๅฐ†ๆˆ‘็š„่ดฆๅทๅŒๆญฅๅˆฐๅŠ›ๆ‰ฃ๏ผˆLeetCode๏ผ‰**</span>\n                <span class=\"display-xs\">ๅฐ†่ดฆๅทๅŒๆญฅๅˆฐ**</span>\n              </a>\n               \n            </div>\n          </div>\n        </div>\n      </div>\n    </aside>\n     \n\n    \n  \n  <div id=\"navbar-root\"></div>\n  \n\n  <div class=\"content-wrapper\" style=\"min-height: 100vh\">\n    <div id=\"base_content\">\n       \n<div class=\"container\">\n  <div class=\"display-404 row col-md-8 col-md-offset-2\">\n    <div class=\"col-md-6\">\n      <img class=\"face-image\" src=\"/static/images/404_face.png\" width=\"250px\" alt=\"404 not found\" />\n    </div>\n\n    <div class=\"col-md-6 msg\">\n      <h2><strong>Page Not Found</strong></h2>\n      <p>Sorry, but we can&apos;t find the page you are looking for...</p>\n      <br>\n      <a class=\"btn btn-default\" href=\"https://leetcode.com/\"><i class=\"fa fa-home\" aria-hidden=\"true\"></i> &nbsp;Back to Home</a>\n    </div>\n  </div>\n</div> <!-- /container -->\n<script>\n  window.LEETCODE_PAGE_NOT_FOUND = true;\n</script>\n\n    </div>\n  </div>\n\n  <div id=\"footer-root\"></div>\n  <script type=\"text/javascript\" src=\"https://assets.leetcode.com/static_assets/public/webpack_bundles/new-apps/navbar-footer/index.22571e7a5.js\" ></script>\n\n\n    <script>\n      $(document).ready(function() {\n        var time_diff = new Date() - new Date(localStorage.getItem(\'region_switcher_last_close_ts\'))\n        if (time_diff > 86400000) {  // 86400000ms == 1day\n          $(\"#region_switcher\").removeClass(\'hide\');\n        }\n      });\n\n      function closeRegion() {\n        $(\"#region_switcher\").addClass(\'hide\');\n        localStorage.setItem(\'region_switcher_last_close_ts\', new Date());\n      }\n    </script>\n\n    \n    \n    \n      <script type=\"text/javascript\">\r\n  var URL =\r\n    \'https://leetcode.com/discuss/general-discussion/655704/\';\r\n  var CONTENT = \'๐Ÿš€ December LeetCoding Challenge ๐Ÿš€\';\r\n\r\n  function getHashCode(str) {\r\n    var hash = 0,\r\n      i,\r\n      chr;\r\n    if (str.length === 0) return hash;\r\n    for (i = 0; i < str.length; i++) {\r\n      chr = str.charCodeAt(i);\r\n      hash = (hash << 5) - hash + chr;\r\n      hash |= 0;\r\n    }\r\n    return hash;\r\n  }\r\n\r\n  var LOCAL_STORAGE_KEY = \'feedback-tab:\' + getHashCode(URL + CONTENT);\r\n  var CLOSE_BUTTON_CLICKED = false;\r\n\r\n  var CLOSE_BUTTON_HTML =\r\n    \'\\\r\n        <?xml version=\"1.0\" encoding=\"UTF-8\"?>\\\r\n        <svg id=\"close-icon-svg\" width=\"24px\" height=\"24px\" viewBox=\"0 0 24 24\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\\\r\n            <title>icon/close</title>\\\r\n            <defs></defs>\\\r\n            <g id=\"close-icon\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\\\r\n                <polygon id=\"path-1\" points=\"19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12\"></polygon>\\\r\n            </g>\\\r\n        </svg>\\\r\n    \';\r\n\r\n  function onClickClose(e) {\r\n    e.preventDefault();\r\n    document\r\n      .querySelector(\'.feedback-anchor\')\r\n      .classList.add(\'feedback-anchor-closing\');\r\n    window.localStorage.setItem(LOCAL_STORAGE_KEY, Date.now());\r\n    CLOSE_BUTTON_CLICKED = true;\r\n  }\r\n\r\n  function onTransitionEnd(event) {\r\n    if (\r\n      event.target &&\r\n      CLOSE_BUTTON_CLICKED &&\r\n      event.propertyName === \'opacity\'\r\n    ) {\r\n      event.target.remove();\r\n    }\r\n  }\r\n\r\n  function createFeedbackTab() {\r\n    var closeButton = document.createElement(\'span\');\r\n    closeButton.classList.add(\'feedback-tab-close-button\');\r\n    closeButton.innerHTML = CLOSE_BUTTON_HTML;\r\n    closeButton.addEventListener(\'click\', onClickClose);\r\n\r\n    var feedbackTabContent = document.createElement(\'span\');\r\n    feedbackTabContent.innerHTML = CONTENT;\r\n\r\n    var feedbackTab = document.createElement(\'div\');\r\n    feedbackTab.classList.add(\'feedback-tab\');\r\n\r\n    feedbackTab.appendChild(feedbackTabContent);\r\n    feedbackTab.appendChild(closeButton);\r\n\r\n    var feedbackAnchor = document.createElement(\'a\');\r\n    feedbackAnchor.classList.add(\'feedback-anchor\');\r\n    feedbackAnchor.setAttribute(\'href\', URL);\r\n    feedbackAnchor.setAttribute(\'target\', \'_blank\');\r\n    feedbackAnchor.appendChild(feedbackTab);\r\n    feedbackAnchor.addEventListener(\'transitionend\', onTransitionEnd);\r\n    return feedbackAnchor;\r\n  }\r\n\r\n  function createComingSoonBanner(text) {\r\n    var banner = document.createElement(\'div\');\r\n    banner.classList.add(\'card-label\');\r\n    banner.style.background = \'rgb(95, 123, 230)\';\r\n    banner.style.color = \'white\';\r\n    banner.style[\'font-weight\'] = \'bold\';\r\n    banner.innerHTML = text;\r\n    return banner;\r\n  }\r\n\r\n  function insertFeedbackTab() {\r\n    var feedbackTab = createFeedbackTab();\r\n    var navbarRightContainer = document.getElementById(\r\n      \'navbar-right-container\'\r\n    );\r\n    if (navbarRightContainer) {\r\n      navbarRightContainer.insertBefore(\r\n        feedbackTab,\r\n        navbarRightContainer.firstChild\r\n      );\r\n    }\r\n  }\r\n\r\n  function insertComingSoonBanner(text, clsname) {\r\n    var banner = createComingSoonBanner(text);\r\n    var exploreCardContainer = document.getElementsByClassName(clsname);\r\n\r\n    if (!exploreCardContainer.length) {\r\n      return false;\r\n    }\r\n\r\n    var innerLayer = exploreCardContainer[0].getElementsByClassName(\r\n      \'top-inner-layer\'\r\n    );\r\n\r\n    if (!innerLayer.length) {\r\n      return false;\r\n    }\r\n\r\n    innerLayer[0].insertBefore(banner, innerLayer[0].firstChild);\r\n    return true;\r\n  }\r\n\r\n  function loadLeetCodeChallenge() {\r\n    if (!window.localStorage.getItem(LOCAL_STORAGE_KEY)) {\r\n      setTimeout(insertFeedbackTab, 500);\r\n    }\r\n\r\n    if (window.location.pathname === \'/explore/\') {\r\n      var comingSoonInterval = setInterval(function() {\r\n        //var res = insertComingSoonBanner(\'Day 16\', \'may-leetcoding-challenge\');\r\n        var res2 = insertComingSoonBanner(\r\n          \'Day 16\',\r\n          \'december-leetcoding-challenge\'\r\n        );\r\n        if (/*res && */ res2 && comingSoonInterval) {\r\n          clearInterval(comingSoonInterval);\r\n        }\r\n      }, 300);\r\n    }\r\n\r\n    var script = document.createElement(\'script\');\r\n    script.async = true;\r\n    script.src = \'https://assets.leetcode-cn.com/lccn-resources/cn.js\';\r\n    document.body.appendChild(script);\r\n  }\r\n</script>\r\n<style>\r\n  .feedback-tab {\r\n    position: absolute;\r\n    display: flex;\r\n    align-items: center;\r\n    top: 0px;\r\n    right: 270px;\r\n    background-color: #455a64;\r\n    color: white;\r\n    opacity: 0.6;\r\n    border-radius: 0 0 3px 3px;\r\n    padding: 5px 10px;\r\n    cursor: pointer;\r\n    z-index: 2;\r\n    transition: all 0.3s ease-in-out;\r\n  }\r\n  .feedback-tab:hover {\r\n    opacity: 1;\r\n  }\r\n  .feedback-tab-close-button {\r\n    margin-left: 5px;\r\n    height: 1em;\r\n    width: 1em;\r\n    display: inline-flex;\r\n    align-items: center;\r\n    justify-content: center;\r\n  }\r\n  .feedback-anchor:focus {\r\n    text-decoration: none;\r\n  }\r\n  .feedback-anchor-closing {\r\n    opacity: 0;\r\n    transition: opacity 0.3s ease-in-out;\r\n  }\r\n  aside#region_switcher {\r\n    position: initial;\r\n  }\r\n  #close-icon-svg {\r\n    opacity: 0.5;\r\n    transition: all 0.3s ease-in-out;\r\n  }\r\n  #close-icon-svg:hover {\r\n    opacity: 1;\r\n  }\r\n  #close-icon {\r\n    fill: white;\r\n  }\r\n</style>\r\n\r\n<!--@START: Nav Highlight Tag -->\r\n<style>\r\n  [class*=\'navbar-nav\'] a[href=\'/explore/\']::after {\r\n    right: -12px !important;\r\n    background: rgb(236, 64, 122) !important;\r\n    content: \'Day 16\' !important;\r\n  }\r\n  [class*=\'navbar-nav\'] a[href=\'/contest/\']::after {\r\n    /*  background: rgb(236,64,122) !important;\r\n  content: \"2\" !important;\r\n*/\r\n  }\r\n  [class*=\'navbar-nav\'] a[href=\'/contest/\']::after,\r\n  [class*=\'navbar-nav\'] a[href=\'/explore/\']::after {\r\n    display: block;\r\n    background: red;\r\n    border-radius: 20px;\r\n    padding: 0px 8px;\r\n    color: white;\r\n    font-size: 12px;\r\n    position: absolute;\r\n    top: 6px;\r\n    right: -3px;\r\n    font-weight: 500;\r\n    transform: scale(0.6);\r\n  }\r\n  [class*=\'nav-item-container\'] a[href=\'/explore/\']::after {\r\n    right: -25px !important;\r\n    content: \'Day 16\' !important;\r\n    background: rgb(236, 64, 122) !important;\r\n  }\r\n  [class*=\'nav-item-container\'] a[href=\'/contest/\']::after {\r\n    /*  background: rgb(236,64,122) !important;\r\n  content: \"2\" !important;\r\n*/\r\n  }\r\n  [class*=\'nav-item-container\'] a[href=\'/contest/\']::after,\r\n  [class*=\'nav-item-container\'] a[href=\'/explore/\']::after {\r\n    display: block;\r\n    background: red;\r\n    border-radius: 20px;\r\n    padding: 0px 8px;\r\n    color: white;\r\n    font-size: 12px;\r\n    position: absolute;\r\n    top: -9px;\r\n    right: -15px;\r\n    font-weight: 500;\r\n    transform: scale(0.6);\r\n  }\r\n</style>\r\n<script type=\"text/javascript\">\r\n  var DISCOUNT_URL = \'/subscribe/\';\r\n  var DISCOUNT_CONTENT =\r\n    \'In an effort to fight COVID-19, from now until a limited time only, users residing in India can enjoy discount on both&nbsp\';\r\n  var DISCOUNT_LINK = \'monthly and annual subscriptions\';\r\n\r\n  function createDiscountTab() {\r\n    var discountTabContent = document.createElement(\'span\');\r\n    discountTabContent.innerHTML = DISCOUNT_CONTENT;\r\n    var subscribeLink = document.createElement(\'a\');\r\n    subscribeLink.setAttribute(\'href\', DISCOUNT_URL);\r\n    subscribeLink.classList.add(\'subscribe-link\');\r\n    subscribeLink.innerHTML = DISCOUNT_LINK;\r\n    var exclamation = document.createElement(\'span\');\r\n    exclamation.innerHTML = \'!\';\r\n\r\n    var discountTab = document.createElement(\'div\');\r\n    discountTab.classList.add(\'col-md-12\');\r\n    discountTab.classList.add(\'alert\');\r\n    discountTab.classList.add(\'alert-warning\');\r\n\r\n    discountTab.appendChild(discountTabContent);\r\n    discountTab.appendChild(subscribeLink);\r\n    discountTab.appendChild(exclamation);\r\n\r\n    var DiscountContainer = document.createElement(\'div\');\r\n    DiscountContainer.classList.add(\'container\');\r\n    DiscountContainer.classList.add(\'row\');\r\n    DiscountContainer.classList.add(\'no-margin\');\r\n    DiscountContainer.classList.add(\'container-center\');\r\n    DiscountContainer.appendChild(discountTab);\r\n    return DiscountContainer;\r\n  }\r\n\r\n  function insertDiscountTab() {\r\n    var discountTab = createDiscountTab();\r\n    var container = document.getElementById(\'base_content\');\r\n    if (container) {\r\n      container.insertBefore(discountTab, container.firstChild);\r\n    }\r\n  }\r\n\r\n  window.onload = function() {\r\n    if (window.LeetCodeData) {\r\n      const {\r\n        features: { enableIndiaPricing },\r\n        userStatus: { countryCode },\r\n      } = window.LeetCodeData;\r\n      if (\r\n        (window.location.pathname === \'/\' ||\r\n          window.location.pathname.startsWith(\'/problemset\')) &&\r\n        enableIndiaPricing &&\r\n        countryCode === \'IN\'\r\n      ) {\r\n        setTimeout(insertDiscountTab, 500);\r\n      }\r\n\r\n      var script = document.createElement(\'script\');\r\n      script.async = true;\r\n      document.body.appendChild(script);\r\n    }\r\n    loadLeetCodeChallenge();\r\n  };\r\n</script>\r\n<style>\r\n  .container-center {\r\n    margin: auto;\r\n    display: flex;\r\n    justify-content: center;\r\n    padding: 0;\r\n    text-align: center;\r\n    margin-top: -10px;\r\n  }\r\n  .subscribe-link {\r\n    cursor: pointer;\r\n  }\r\n</style>\n    \n\n    \n\n    <script src=\"/static/legacy/common/js/base.js\"></script>\n\n    <script>\n      try {\n        ace.config.set(\"basePath\", \"/static/ace-builds/src-noconflict/\")\n      } catch(err) {}\n    </script>\n\n    <script>\n      function recaptchaV2Callback() {\n        window.grecaptchaV2 = Object.assign(Object.create(Object.getPrototypeOf(window.grecaptcha)), window.grecaptcha)\n      }\n\n      function recaptchaV3Callback() {\n        window.grecaptchaV3 = Object.assign(Object.create(Object.getPrototypeOf(window.grecaptcha)), window.grecaptcha)\n      }\n    </script>\n\n    <script src=\"https://www.recaptcha.net/recaptcha/api.js?onload=recaptchaV2Callback&render=explicit\" async\n      defer></script>\n\n    \n    <script\n      src=\"https://www.recaptcha.net/recaptcha/api.js?onload=recaptchaV3Callback&render=6LdBpsIUAAAAAKAYWjZfIpn4cJHVIk_tsmxpl7cz\"></script>\n  </body>\n</html>\n"
[2020-12-17T03:15:31Z DEBUG leetcode_cli::cache] debug json deserializing: 
    Err(
        Error("expected value", line: 1, column: 1),
    )
error: expected value at line 1 column 1

The json deserialize error. How can I solve this problem?

Error for `pick`, `edit`, `test`, `exec`

I get an error when running any of the problem-related subcommands (pick, edit, test, exec)

leetcode pick 1

[1] Two Sum is on the run...

error: invalid type: map, expected a string at line 4 column 4

The other commands (help, data, list, stat) all work as expected.

Output with debug flag:

leetcode -d pick 1

[1] Two Sum is on the run...


[2021-05-09T12:41:58Z TRACE leetcode_cli::plugins::leetcode] Requesting two-sum detail...
[2021-05-09T12:41:58Z TRACE leetcode_cli::plugins::leetcode::req] Running leetcode::get_problem_detail...
[2021-05-09T12:41:59Z DEBUG leetcode_cli::cache] Object({
        "data": Object({
            "question": Object({
                "codeDefinition": String(
                    "[{\"value\": \"cpp\", \"text\": \"C++\", \"defaultCode\": \"class Solution {\\npublic:\\n    vector<int> twoSum(vector<int>& nums, int target) {\\n        \\n    }\\n};\"}, {\"value\": \"java\", \"text\": \"Java\", \"defaultCode\": \"class Solution {\\n    public int[] twoSum(int[] nums, int target) {\\n        \\n    }\\n}\"}, {\"value\": \"python\", \"text\": \"Python\", \"defaultCode\": \"class Solution(object):\\n    def twoSum(self, nums, target):\\n        \\\"\\\"\\\"\\n        :type nums: List[int]\\n        :type target: int\\n        :rtype: List[int]\\n        \\\"\\\"\\\"\\n        \"}, {\"value\": \"python3\", \"text\": \"Python3\", \"defaultCode\": \"class Solution:\\n    def twoSum(self, nums: List[int], target: int) -> List[int]:\\n        \"}, {\"value\": \"c\", \"text\": \"C\", \"defaultCode\": \"\\n\\n/**\\n * Note: The returned array must be malloced, assume caller calls free().\\n */\\nint* twoSum(int* nums, int numsSize, int target, int* returnSize){\\n\\n}\"}, {\"value\": \"csharp\", \"text\": \"C#\", \"defaultCode\": \"public class Solution {\\n    public int[] TwoSum(int[] nums, int target) {\\n        \\n    }\\n}\"}, {\"value\": \"javascript\", \"text\": \"JavaScript\", \"defaultCode\": \"/**\\n * @param {number[]} nums\\n * @param {number} target\\n * @return {number[]}\\n */\\nvar twoSum = function(nums, target) {\\n    \\n};\"}, {\"value\": \"ruby\", \"text\": \"Ruby\", \"defaultCode\": \"# @param {Integer[]} nums\\n# @param {Integer} target\\n# @return {Integer[]}\\ndef two_sum(nums, target)\\n    \\nend\"}, {\"value\": \"swift\", \"text\": \"Swift\", \"defaultCode\": \"class Solution {\\n    func twoSum(_ nums: [Int], _ target: Int) -> [Int] {\\n        \\n    }\\n}\"}, {\"value\": \"golang\", \"text\": \"Go\", \"defaultCode\": \"func twoSum(nums []int, target int) []int {\\n    \\n}\"}, {\"value\": \"scala\", \"text\": \"Scala\", \"defaultCode\": \"object Solution {\\n    def twoSum(nums: Array[Int], target: Int): Array[Int] = {\\n        \\n    }\\n}\"}, {\"value\": \"kotlin\", \"text\": \"Kotlin\", \"defaultCode\": \"class Solution {\\n    fun twoSum(nums: IntArray, target: Int): IntArray {\\n        \\n    }\\n}\"}, {\"value\": \"rust\", \"text\": \"Rust\", \"defaultCode\": \"impl Solution {\\n    pub fn two_sum(nums: Vec<i32>, target: i32) -> Vec<i32> {\\n        \\n    }\\n}\"}, {\"value\": \"php\", \"text\": \"PHP\", \"defaultCode\": \"class Solution {\\n\\n    /**\\n     * @param Integer[] $nums\\n     * @param Integer $target\\n     * @return Integer[]\\n     */\\n    function twoSum($nums, $target) {\\n        \\n    }\\n}\"}, {\"value\": \"typescript\", \"text\": \"TypeScript\", \"defaultCode\": \"function twoSum(nums: number[], target: number): number[] {\\n\\n};\"}, {\"value\": \"racket\", \"text\": \"Racket\", \"defaultCode\": \"(define/contract (two-sum nums target)\\n  (-> (listof exact-integer?) exact-integer? (listof exact-integer?))\\n\\n  )\"}]",
                ),
                "content": String(
                    "<p>Given an array of integers <code>nums</code>&nbsp;and an integer <code>target</code>, return <em>indices of the two numbers such that they add up to <code>target</code></em>.</p>\n\n<p>You may assume that each input would have <strong><em>exactly</em> one solution</strong>, and you may not use the <em>same</em> element twice.</p>\n\n<p>You can return the answer in any order.</p>\n\n<p>&nbsp;</p>\n<p><strong>Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> nums = [2,7,11,15], target = 9\n<strong>Output:</strong> [0,1]\n<strong>Output:</strong> Because nums[0] + nums[1] == 9, we return [0, 1].\n</pre>\n\n<p><strong>Example 2:</strong></p>\n\n<pre>\n<strong>Input:</strong> nums = [3,2,4], target = 6\n<strong>Output:</strong> [1,2]\n</pre>\n\n<p><strong>Example 3:</strong></p>\n\n<pre>\n<strong>Input:</strong> nums = [3,3], target = 6\n<strong>Output:</strong> [0,1]\n</pre>\n\n<p>&nbsp;</p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li><code>2 &lt;= nums.length &lt;= 10<sup>3</sup></code></li>\n\t<li><code>-10<sup>9</sup> &lt;= nums[i] &lt;= 10<sup>9</sup></code></li>\n\t<li><code>-10<sup>9</sup> &lt;= target &lt;= 10<sup>9</sup></code></li>\n\t<li><strong>Only one valid answer exists.</strong></li>\n</ul>\n",
                ),
                "enableRunCode": Bool(
                    true,
                ),
                "metaData": String(
                    "{\n  \"name\": \"twoSum\",\n  \"params\": [\n    {\n      \"name\": \"nums\",\n      \"type\": \"integer[]\"\n    },\n    {\n      \"name\": \"target\",\n      \"type\": \"integer\"\n    }\n  ],\n  \"return\": {\n    \"type\": \"integer[]\",\n    \"size\": 2\n  },\n  \"manual\": false\n}",
                ),
                "sampleTestCase": String(
                    "[2,7,11,15]\n9",
                ),
                "stats": String(
                    "{\"totalAccepted\": \"4.2M\", \"totalSubmission\": \"9M\", \"totalAcceptedRaw\": 4202496, \"totalSubmissionRaw\": 8966956, \"acRate\": \"46.9%\"}",
                ),
                "translatedContent": Null,
            }),
        }),
    })
error: invalid type: map, expected a string at line 4 column 4

I am running Ubuntu 20.10 x86_64. Error occurs in both fish and bash shells. leetcode-cli 0.3.3

leetcode test error: invalid type: sequence, expected a string at line 1 column 162

Hello, I encountered a strange problem.

~# leetcode pick 704
~# leetcode edit 704 # return True
~# leetcode test 704
[INFO  leetcode_cli::plugins::leetcode] Sending code to judge...
error: invalid type: sequence, expected a string at line 1 column 162

I have logined in leetcode.com with Microsoft Edge and the exec command works well, and I have checked #55 and #67.
Here is the message when I execute leetcode exec 704

~# leetcode exec 704
[INFO  leetcode_cli::plugins::leetcode] Sending code to judge...

Success

Here is the last part of debug log

2022-07-28T16:01:41Z TRACE leetcode_cli::cache] Run veriy recursion...
[2022-07-28T16:01:41Z TRACE leetcode_cli::plugins::leetcode] Verifying result...
[2022-07-28T16:01:41Z TRACE leetcode_cli::plugins::leetcode::req] Running leetcode::verify_result...
[2022-07-28T16:01:41Z DEBUG leetcode_cli::cache] debug resp raw text:
    "{\"status_code\": 10, \"lang\": \"cpp\", \"run_success\": true, \"status_runtime\": \"3 ms\", \"memory\": 6216000, \"code_answer\": [\"4\", \"-1\"], \"code_output\": [], \"std_output\": [\"\", \"\", \"\"], \"elapsed_time\": 39, \"task_finish_time\": 1659024099990, \"expected_status_code\": 10, \"expected_lang\": \"cpp\", \"expected_run_success\": true, \"expected_status_runtime\": \"3\", \"expected_memory\": 6176000, \"expected_code_answer\": [\"4\", \"-1\"], \"expected_code_output\": [], \"expected_std_output\": [\"\", \"\", \"\"], \"expected_elapsed_time\": 15, \"expected_task_finish_time\": 1659023544000, \"correct_answer\": true, \"compare_result\": \"11\", \"total_correct\": 2, \"total_testcases\": 2, \"runtime_percentile\": null, \"status_memory\": \"6.2 MB\", \"memory_percentile\": null, \"pretty_lang\": \"C++\", \"submission_id\": \"runcode_1659024097.2677104_Wo25CvI7Tn\", \"status_msg\": \"Accepted\", \"state\": \"SUCCESS\"}"
[2022-07-28T16:01:41Z DEBUG leetcode_cli::cache] debug json deserializing:
    Err(
        Error("invalid type: sequence, expected a string", line: 1, column: 162),
    )
error: invalid type: sequence, expected a string at line 1 column 162

The entire log is so long that I cannot paste it here. If anyone needs it, I will paste later

Migrate clap to structopt

clap is well-known but heavy and long time not updating, though it says clap team has an upgrading plan this year.

structopt is cooler and lighter than clap, I didn't know this crate when I wrote leetcode-cli otherwise I wouldn't use clap XD.

Well, I find that structopt depends on clap now, not sure if we need this.

reopen if need.

Tags table in the database file is empty

I was trying to get the plan1.py script to filter the questions. After fixing a couple of things to get the python script to work, I noticed that the the stags argument to the python script is empty.

I then proceeded to connect sqlite3 to the database file at ~/.leetcode/Problems. When selecting entries from the table 'tags' there seemed to be no entries. My assumption is this is the tag such as Dynamic Programming or Array.. Is the tag table not populated anymore or is this some error?

missing field `pick` for key `code` at line 1 column 1

$ .cargo/bin/leetcode pick 1
error: missing field `pick` for key `code` at line 1 column 1, Parse config file failed, leetcode-cli has just generated a new leetcode.toml at ~/.leetcode/leetcode_tmp.toml, the current one at ~/.leetcode/leetcode.tomlseems missing some keys, please compare to the tmp one and add them up : )

side note: are y'all copying the executable to usr/local/bin or similar to make it accessible everywhere?

`emacsclient` doesn't works.

I am trying to open via leetcode edit <ID> command, it is working fine with vim, nvim & even emacs but does not open the file with emacsclient it gives error:

$ leetcode edit 1
error: No such file or directory (os error 2), please try again

here's my leetcode.toml

[code]
editor = "emacsclient -n -s doom"             # "nvim" and "emacs" works fine
lang = "cpp"
pick = "${fid}.${slug}"
submission = "${fid}.${slug}.${sid}.${ac}"

Note: emacsclient is the command to use emacs in daemon-client mode.

Pick fails to parse 1214 json response.

Error thrown:

$ leetcode pick 1214

[1214] Two Sum BSTs is on the run...


json from response parse failed, please open a new issue at: https://github.com/clearloop/leetcode-cli/.```

Cannot get Chrome Safe Storage password

The following code fails with an error KeyringError::NoPasswordFound.

let ring = Entry::new("Chrome Safe Storage", "Chrome");
let pass = ring.get_password().expect("Get Password failed");

If I open seahorse, I see the relevant item (so the attribute name is correct), but I couldn't find info about the username assigned to that record.
image
Can you point me in the correct direction? I assume that the username might be wrong, but I have no idea where to check which one is used with Chrome Safe Storage.

leetcode pick: wrong constraints

Environment

Windows Terminal Preview, Alacrity

Steps to reproduce

leetcode pick 405

Expected

Constraints:
-231 <= num <= 231 - 1

What`s happening

Constraints:
-20 <= num <= 20 - 1

Comment

This problem is not just for 405. I have seen several problems that does not render 231 correctly.

There are two problems.

  1. Wrong number shows up in constraints.
  2. Superscript is not rendered.

"Superscript" works in some problems but sometimes it does not.
Could you point me to the corresponding module?

I don't think this is a terminal-dependent problem.

non-algorithm problems cause an infinite loop

$ leetcode p 1285

[1285] Find the Start and End Number of Continuous Ranges is on the run...


error: Not support database and shell questions for now

[1285] Find the Start and End Number of Continuous Ranges is on the run...


error: Not support database and shell questions for now
... < repeating infinitely > ...

Add Linux support

Linux users should be the main users of leetcode-cli, and what embarrassed is, it just supports OSX now...

Reason

It caused by the decoding process about chrome cookies, the iter field for OSX is 1003, and for Linux is 1, it doesn't be fixed is just because I don't have enough time to test...

Finally

Linux will be supported at v0.2.0, btw, test and submit will be avaiable at the same time.

2020.1.5

Already add Linux supports, need more tests.

2020.1.6

Add Cookie configs, support all platforms.

Build fails

To reproduce:

git clone https://github.com/clearloop/leetcode-cli
cd leetcode-cli
cargo build

Note that this using the required toolchain nightly-2021-05-16 as confirmed with rustup.

Output:

error[E0599]: no function or associated item named `from_str` found for struct `proc_macro::Literal` in the current scope
   --> /home/psacawa/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.30/src/wrapper.rs:926:38
    |
926 |                 proc_macro::Literal::from_str(repr)
    |                                      ^^^^^^^^ function or associated item not found in `proc_macro::Literal`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0599`.
error: could not compile `proc-macro2`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed

trouble editting a problem

when I try 1797 I get the following error:

leetcode edit 1797

[1797] Design Authentication Manager is on the run...


error: missing field `params` at line 61 column 1

I tried deleting / updating my cache hoping this would fix it but it seems not to. :/

cannot find type `NoneError` in module `std::option`

System:
Ubuntu 20.04 on wsl2
Issue:
The program does not compile any more. I guess this has something to do with nightly build.
rustc 1.54.0-nightly (ff2c947c0 2021-05-25)
log:

error[E0412]: cannot find type `NoneError` in module `std::option`
   --> src/err.rs:118:38
    |
118 | impl std::convert::From<std::option::NoneError> for Error {
    |                                      ^^^^^^^^^ not found in `std::option`

error[E0412]: cannot find type `NoneError` in module `std::option`
   --> src/err.rs:119:29
    |
119 |     fn from(_: std::option::NoneError) -> Self {
    |                             ^^^^^^^^^ not found in `std::option`

error[E0277]: the `?` operator can only be used on `Result`s, not `Option`s, in an async function that returns `Result`
  --> src/plugins/leetcode.rs:75:29
   |
69 |       pub async fn get_category_problems(self, category: &str) -> Result<Response, Error> {
   |  _________________________________________________________________________________________-
70 | |         trace!("Requesting {} problems...", &category);
71 | |         let url = &self
72 | |             .conf
...  |
75 | |             .get("problems")?
   | |                             ^ use `.ok_or(...)?` to provide an error compatible with `Result<Response, err::Error>`
...  |
88 | |         .await
89 | |     }
   | |_____- this function returns a `Result`
   |
   = help: the trait `FromResidual<std::option::Option<Infallible>>` is not implemented for `Result<Response, err::Error>`
   = note: required by `from_residual`
(85 errors)

byte index 129 is not a char boundary; it is inside '\u{200b}'

$ RUST_BACKTRACE=1 leetcode p 1653

[1653] Minimum Deletions to Make String Balanced is on the run...


thread 'main' panicked at 'byte index 129 is not a char boundary; it is inside '\u{200b}' (bytes 127..130) of `<p>You are given a string <code>s</code> consisting only of characters <code>&#39;a&#39;</code> and <code>&#39;b&#39;</code>โ€‹โ€‹โ€‹โ€‹.</p>

<p>You can delete any number of characters in <code>s</code> to make <code>s</code> <strong>balanced</strong>. <c`[...]', /home/throwaway/.cargo/registry/src/github.com-1ecc6299db9ec823/leetcode-cli-0.3.10/src/helper.rs:183:58
stack backtrace:
   0: rust_begin_unwind
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panicking.rs:517:5
   1: core::panicking::panic_fmt
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/panicking.rs:101:14
   2: core::str::slice_error_fail
   3: <alloc::string::String as leetcode_cli::helper::html::HTML>::ser
   4: <alloc::string::String as leetcode_cli::helper::html::HTML>::render
   5: <leetcode_cli::cache::models::Question as core::fmt::Display>::fmt
   6: core::fmt::write
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/fmt/mod.rs:1150:17
   7: std::io::Write::write_fmt
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/io/mod.rs:1667:15
   8: <&std::io::stdio::Stdout as std::io::Write>::write_fmt
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/io/stdio.rs:852:9
   9: <std::io::stdio::Stdout as std::io::Write>::write_fmt
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/io/stdio.rs:826:9
  10: std::io::stdio::print_to
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/io/stdio.rs:1192:21
  11: std::io::stdio::_print
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/io/stdio.rs:1205:5
  12: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
  13: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
  14: tokio::macros::scoped_tls::ScopedKey<T>::set
  15: tokio::runtime::basic_scheduler::BasicScheduler<P>::block_on
  16: tokio::runtime::context::enter
  17: tokio::runtime::handle::Handle::enter
  18: leetcode::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Problem link here. The \u200b characters appear right before the first closing p tag in the error.

/usr/bin/ld: cannot find -ldbus-1

Trying to install it through cargo, but it's giving me this error message :

  = note: /usr/bin/ld: cannot find -ldbus-1
          collect2: error: ld returned 1 exit status
          

error: failed to compile `leetcode-cli v0.3.10`, intermediate artifacts can be found at `/tmp/cargo-installMTRpnO`

Caused by:
  could not compile `leetcode-cli` due to previous error

cargo -V
cargo 1.60.0

and I'm running Fedora 35

Cannot read locked problem (premium account)

Thanks for great work. The program is blazing fast and I like it.
Currently, leetcode-cli cannot retrieve the locked problems for premium account.
Is there a solution for this?

Tag support

Lots of people do have plans to solve LeetCode problems, for example, my round-1 plan is solving all easy problems, they do have orders by tag:

easy {
  linked_list
  tree
  binary_search
  two_pointer
  string
  array
  ...
}

The question is, the raw response of all_problems API's data struct doesn't contain the tag field, so leetcode-cil has to add a new request fetching tags and applying them to problems.

It will be added to the next version.

Programmable leetcode-cli

Furthermore, I've got a new idea about programmable leetcode-cli, which means that users deserve the ability to manually make their coding plans through leetcode-cli scripts.

It comes up with the v8 Javascript Engine and v8-rs, emmm...it's coming.

Tag support

Added at ffb873b

Errors when running test and exec commands

I seem to be getting errors when running test and exec commands for any file. This suddenly started happening today, because yesterday I ran the commands and they worked just fine to test and submit a problem to leetcode.

Today when I run leetcode test I get the error: error: expected value at line 1 column 1 and when I run leetcode exec I get the error: error: EOF while parsing a value at line 1 column 0. I'm looking into the errors myself but if anyone else can reproduce these errors, and maybe can also help find the bugs, or have a general idea of what the problem is please do share.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.