Nexium

Leetcodes

Nexium: Your Algorithmic Companion - Production-Ready LeetCode Solutions Just One Import Away

Import the NLeet

const { NLeet } = require('nexium')

twoSum

twoSum solution

const numbers = [2, 7, 11, 15]
const target = 9
const result = NLeet.twoSum(numbers, target) // [0, 1]

longestSubstring

Longest substring without repeating characters

const result = NLeet.longestSubstring('abcabcbb') // 3

isValidParentheses

Valid Parentheses

const result = NLeet.isValidParentheses('()[]{}') // true

isValidAnagram

Valid Anagram

const result = NLeet.isValidAnagram('anagram', 'nagaram') // true

reverseInteger

function to reverse integer

const result = NLeet.reverseInteger(123) // 321

isIntegerPalindrome

function to check given number is palindrome

const result = NLeet.isIntegerPalindrome(121) // true

kMostFrequent

function to find the k most frequent elements

const result = NLeet.kMostFrequent([1, 1, 1, 2, 2, 3], 2) // [1,2]

On this page