一、Node.js安装
- 下载Node.js
junli@ubuntu16:~$ wget https://nodejs.org/dist/v16.11.0/node-v16.11.0-linux-x64.tar.xz
- 安装
junli@ubuntu16:~$ tar -xvf node-v16.11.0-linux-x64.tar.xz ## 解压
junli@ubuntu16:~$ mv node-v16.11.0-linux-x64 nodejs ## 修改名字
junli@ubuntu16:~$ cd nodejs/bin
junli@ubuntu16:~/nodejs/bin$ node -v ## 查看版本号
v16.11.0
junli@ubuntu16:~/nodejs/bin$ pwd ## 查看安装路径,Vscode中配置Node.js的时候需要
/home/junli/nodejs/bin
其他操作系统的安装教程见Node.js教程
二、Vscode中安装Leetcode插件
- 安装:Ctrl + shift + x,搜索leetcode,点击Install
三、Vscode中配置Node.js环境设置
-
ctrl + , 打开setting,搜索leetcode
-
Leetcode: Default Language设置刷题使用的语言
-
Leetcode: Endpoint 选择 leetcode-cn
-
Leetcode: Node Path中添加node安装目录【/home/junli/nodejs/bin/node】
-
Leetcode:Workspace Folder中设置Leetcode刷题工作目录
-
-
选择中文版
-
登录Leetcode账号
-
答题
选择要做的题目,然后点击右下角【Code Now】写代码