Skip to content

lazzzis/LeetCode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Q: What is LZS? It almost appears inside all files (like js, cpp)? A: Briefly speaking, that is an environment variable defined in my System. For unix/linux, you can add a command export LZS='true' in ~/.bashrc such that process.env.LZS evaluates to true rather than undefined.

The purpose of defining such a variable is to ensure some piece of code can only work in my computer and does not work in Leetcode server environment. In other words, some tests can work locally but have nothing to do with Leetcode server.

Take 006/main.js as an example.

if (process.env.LZS) { // local test
  const assert = require('chai').assert
  assert.strictEqual(convert('PAYPALISHIRING', 3), 'PAHNAPLSIIGYIR')
  assert.strictEqual(convert('0123456789', 5), '0817926354')
  assert.strictEqual(convert('0123456789', 1), '0123456789')
  assert.strictEqual(convert('0123456789', 2), '0246813579')
  assert.strictEqual(convert('0123456', 2000), '0123456')
}

As you can see, the function of this code works as some tests. This piece of code would not run on Leetcode server/judger. So you don't have to worry this code would cause Time Limited Exceeded (since some tests would consume quite a long time).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published