Preface

The Remote SSH extension in VS Code provides the functionality to connect to other remote hosts. While the basic way of connection requires a username and password, using a key allows for direct login without the effort to type the password every time.

However, it’s crucial to understand that VS Code merely provides a GUI, and how to use a SSH key to login is a separate matter. These two aspects should not be confused.

This article will primarily explain how to configure SSH keys on both the local machine and the remote machine. Subsequently, it will delve into the usage of the VS Code Remote SSH extension.

Read more »

Preface

Python is renowned for its rich set of modules. However, unlike in Java development where Maven uses group Id, artifact Id, and version to uniquely identify a dependency, in practice, most Python projects differentiate modules solely by their names. Run pip install <module>, and you’ve got the module. But what about the module version? Most project requirements do not specify versions, leading to constant errors for those who run the project later.

Hence, the concept of a weakened version number undoubtedly does more harm than good. How to solve this issue? By using venv (virtual environment).

If you directly use pip install, all Python projects share these modules, leading to potential compatibility issues. Venv copies the original Python environment. The virtual environment runs only on the copied Python, and the installed modules exist only in that virtual environment. Multiple virtual environments are isolated from each other.

Usage

1️⃣Create venv:

1
python -m venv C:\Users\Gustav\Desktop\test\venv

The directory C:\Users\Gustav\Desktop\test\venv is the virtual environment.

Read more »

Overview

LeetCode Weekly Contest 370

This article is a summary of the weekly contest. I do not plan to discuss each problem in detail; for some problems, I will only provide a rough outline. The point of this article is self-reflection and improvement.

Achieved AC in the first three problems within 23 minutes, resulting in a ranking around 300 - more like a typing contest emphasizing speed rather than a coding contest. Brief description of problem-solving:

  • Problem 1: Easy problem but got stuck for 5 minutes 😒;
  • Problem 2: Similar to the first one in terms of background, also easy problem, but solved faster 😋;
  • Problem 3: A real medium-level problem that required a bit more thought, solved in 15 minutes, not bad 😋;
  • Problem 4: Couldn’t solve. If the data range is small, it’s a simple DP problem, but couldn’t find an optimization 😒;
Read more »

Problem

Source: 2127. Maximum Employees to Be Invited to a Meeting (Daily Problem)

A company is organizing a meeting and has a list of n employees, waiting to be invited. They have arranged for a large circular table, capable of seating any number of employees.

The employees are numbered from 0 to n - 1. Each employee has a favorite person and they will attend the meeting only if they can sit next to their favorite person at the table. The favorite person of an employee is not themselves.

Given a 0-indexed integer array favorite, where favorite[i] denotes the favorite person of the ith employee, return the maximum number of employees that can be invited to the meeting.

Example 1

Input: favorite = [2,2,1,2] Output: 3

image-20231101114926490image-20231101125447756

Read more »
0%