📄 New here? 👉 See how to use this template →
A quick one-liner describing the problem.
Example: Check if two strings are anagrams.
Your goal is to solve the coding challenge using a clear and efficient solution.
- Read the problem and input/output requirements
- Implement your solution in
src/main.mjs
- Run tests with
npm run test
to validate your solution
Describe the problem in detail.
Example:
Given two strings s1
and s2
, return true
if s2
is an anagram of s1
, and false
otherwise.
An anagram is a word or phrase formed by rearranging the letters of a different word.
s1
: a string (1 ≤ s1.length ≤ 10⁵)s2
: a string (1 ≤ s2.length ≤ 10⁵)- No spaces, only lowercase letters
- Returns
true
orfalse
- Open the file
src/main.mjs
and implement the solution. - To verify your solution, run the tests in
src/main.test.js
using:
npm run test
✅ Do not modify the test file unless you’re adding extra edge cases.
You can add any tips or hints that might help the user solve the problem.
For example:
- Use
.toLowerCase()
if needed - Use objects, arrays or
Map
to count character frequencies - Aim for O(n) time complexity if possible
- Compare frequency maps or use one-pass counter
This repo uses Vitest. To run tests locally:
npm install
npm run test
✅ Make sure your implementation is in src/main.mjs
and your tests in src/main.test.js
.
Happy coding! 🚀