npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

leetcode-contest-cli

v0.8.6

Published

## Warning

Downloads

9

Readme

CLI for LeetCode Contests

Warning

Experimental. Use at your own risk.

在正式比赛中使用的风险未知。

Supported Languages

JavaScript/TypeScript/Python3/C++/Go/Rust/Kotlin/Java

Requirements

  • Node.js v14+
  • Google Chrome
  • (Optional) Visual Studio Code

Requirements for Specific Language

  • JavaScript/TypeScript
$ npm i -g esbuild

Note for Windows

Allow running scripts

set-ExecutionPolicy RemoteSigned

Install

$ npm i -g leetcode-contest-cli

Upgrade

$ npm update -g leetcode-contest-cli

First run

$ mkdir mySolutions
$ cd mySolutions
$ lcc init

Google Chrome Executable Path

$ lcc
? Google Chrome executable path: › 

Where to find Chrome

Type chrome://version/ in the address bar.

Typical values:

  • Mac OSX: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
  • Windows: C:\Program Files\Google\Chrome\Application\chrome.exe
  • Linux: /usr/bin/google-chrome-stable

Choosing Site

$ lcc
✔ Google Chrome executable path: … /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
✔ Choose a site › 力扣 (leetcode.cn)

Login

Before doing this, make sure you have already registered for the contest or have started a virtual contest.

Login in the opened browser window.

Starting a Contest

Preferred Language

$ lcc
? Choose a language › - Use arrow-keys. Return to submit.
❯   JavaScript
    TypeScript
    Python
    C++
    Go
    Rust
    Kotlin
    Java

Contest URL

$ lcc
✔ Choose a language › TypeScript
✔ Contest URL: … https://leetcode.cn/contest/weekly-contest-298/

Solving Problems

Choosing a Problem

$ lcc list
? Choose a problem › - Use arrow-keys. Return to submit.
❯   兼具大小写的最好英文字母
    个位数字为 K 的整数之和
    小于等于 K 的最长二进制子序列
    卖木头块

Project Structure

exa --tree
.
├── contests
│  └── weekly-contest-298
│     └── greatest-english-letter-in-upper-and-lower-case
│        ├── id
│        ├── input
│        ├── output
│        ├── screenshot.png
│        └── src
│           └── ts
│              ├── lib -> ../../../../../lib/ts
│              └── solution.ts
└── lib
   └── ts
  • input: Test input. Add new cases here.
  • output: Expected output. Add new cases here.
  • screenshot.png: Screenshot of original webpage.
  • solution.*: Edit your solution here.
  • lib: Put your code snippets here to be imported by your solution.

Test Solution

$ lcc test

  ...eatest-english-letter-in-upper-and-lower-case/build/ts/solution.js  1.1kb

⚡ Done in 9ms

STARTED
expected:
"E"
"R"
""
got:
undefined
undefined
undefined

Edit your solution and test again:

$ lcc test

  ...eatest-english-letter-in-upper-and-lower-case/build/ts/solution.js  1.4kb

⚡ Done in 2ms

PENDING
SUCCESS

Submit Solution

$ lcc submit
STARTED
Accepted
runtime: 64 ms
memory: 43.1 MB

Other Options

Start Another Contest

$ lcc https://leetcode.cn/contest/biweekly-contest-81/
? Choose a problem › - Use arrow-keys. Return to submit.
❯   统计星号
    统计无向图中无法互相到达点对数
    操作后的最大异或和
    不同骰子序列的数目

Use a Different Language

$ lcc lang
? Choose a language › - Use arrow-keys. Return to submit.
❯   JavaScript
    TypeScript
    Python
    C++
    Go
    Rust
    Kotlin
    Java

Troubleshooting

If you encouter errors, append -v to the command you just typed to see what was going on.

Session Expired

Your login session may expire if you have logged in another browser window. You can login again if you have encountered errors.

$ lcc login

Migration

v0.5.0

  • Run lcc lang after upgrading