Package Exports
- blind75_algorithms
- blind75_algorithms/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (blind75_algorithms) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
LeetCode Algorithms
A collection of LeetCode algorithm solutions in JavaScript.
Installation
First, install your package using npm:
npm install blind75_algorithmsImporting Into .js File
In JavaScript file, import the function using either CommonJS or ES Module syntax, depending on project setup:
// Using CommonJS
const { containsDuplicate } = require('blind75_algorithms');
// Using ES Modules
import { containsDuplicate } from 'blind75_algorithms';Example Usage
Then, use the specific function:
// Using CommonJS
const { containsDuplicate } = require('blind75_algorithms');
// Using ES Modules
// import { containsDuplicate } from 'blind75_algorithms';
// Test cases
const nums1 = [1, 2, 3, 1]; // Duplicates in array => true
const nums2 = []; // Empty array => false
const nums3 = [1, 2, 3]; // No duplicates in array => false
console.log(containsDuplicate(nums1)); // Output: true
console.log(containsDuplicate(nums2)); // Output: false
console.log(containsDuplicate(nums3)); // Output: falseThis example demonstrates how users of this package can easily import and use the containsDuplicate function from this blind75_algorithms package in their own projects.
Algorithms
This package includes the following algorithms:
- containsDuplicate
- twoSum
- maxSubArray