id
int64
1
10k
question
stringclasses
10 values
solution
stringclasses
10 values
difficulty
stringclasses
3 values
topic
stringclasses
5 values
5,601
Write a function that reverses a string.
function reverseString(s) { return s.split('').reverse().join(''); }
easy
strings
5,602
Write a function that prints numbers from 1 to 100.
function printNumbers() { for (let i = 1; i <= 100; i++) { console.log(i); } }
hard
loops
5,603
Write a function that removes duplicates from an array.
function removeDuplicates(arr) { return [...new Set(arr)]; }
hard
arrays
5,604
Write a function that returns the factorial of a number.
function factorial(n) { if (n === 0) return 1; return n * factorial(n - 1); }
hard
math
5,605
Write a recursive function to sum an array.
function sumArrayRec(arr, index = 0) { if (index >= arr.length) return 0; return arr[index] + sumArrayRec(arr, index + 1); }
easy
recursion
5,606
Write a function that checks if a string is a palindrome.
function isPalindrome(s) { return s === s.split('').reverse().join(''); }
medium
strings
5,607
Write a function that finds even numbers in an array.
function findEven(arr) { return arr.filter(num => num % 2 === 0); }
easy
loops
5,608
Write a recursive function to sum an array.
function sumArrayRec(arr, index = 0) { if (index >= arr.length) return 0; return arr[index] + sumArrayRec(arr, index + 1); }
easy
recursion
5,609
Write a function that prints numbers from 1 to 100.
function printNumbers() { for (let i = 1; i <= 100; i++) { console.log(i); } }
easy
loops
5,610
Write a function that returns the sum of an array.
function sumArray(arr) { return arr.reduce((a, b) => a + b, 0); }
easy
arrays
5,611
Write a function that checks if a string is a palindrome.
function isPalindrome(s) { return s === s.split('').reverse().join(''); }
medium
strings
5,612
Write a function that removes duplicates from an array.
function removeDuplicates(arr) { return [...new Set(arr)]; }
medium
arrays
5,613
Write a function that returns the sum of an array.
function sumArray(arr) { return arr.reduce((a, b) => a + b, 0); }
hard
arrays
5,614
Write a recursive function to sum an array.
function sumArrayRec(arr, index = 0) { if (index >= arr.length) return 0; return arr[index] + sumArrayRec(arr, index + 1); }
medium
recursion
5,615
Write a function that checks if a number is prime.
function isPrime(n) { if (n <= 1) return false; for (let i = 2; i * i <= n; i++) { if (n % i === 0) return false; } return true; }
easy
math
5,616
Write a function that checks if a number is prime.
function isPrime(n) { if (n <= 1) return false; for (let i = 2; i * i <= n; i++) { if (n % i === 0) return false; } return true; }
easy
math
5,617
Write a function that checks if a string is a palindrome.
function isPalindrome(s) { return s === s.split('').reverse().join(''); }
medium
strings
5,618
Write a function that checks if a string is a palindrome.
function isPalindrome(s) { return s === s.split('').reverse().join(''); }
easy
strings
5,619
Write a function that returns the sum of an array.
function sumArray(arr) { return arr.reduce((a, b) => a + b, 0); }
hard
arrays
5,620
Write a function that removes duplicates from an array.
function removeDuplicates(arr) { return [...new Set(arr)]; }
easy
arrays
5,621
Write a function that finds even numbers in an array.
function findEven(arr) { return arr.filter(num => num % 2 === 0); }
easy
loops
5,622
Write a function that reverses a string.
function reverseString(s) { return s.split('').reverse().join(''); }
medium
strings
5,623
Write a function that returns the factorial of a number.
function factorial(n) { if (n === 0) return 1; return n * factorial(n - 1); }
easy
math
5,624
Write a recursive function to sum an array.
function sumArrayRec(arr, index = 0) { if (index >= arr.length) return 0; return arr[index] + sumArrayRec(arr, index + 1); }
easy
recursion
5,625
Write a function that checks if a string is a palindrome.
function isPalindrome(s) { return s === s.split('').reverse().join(''); }
medium
strings
5,626
Write a function that finds even numbers in an array.
function findEven(arr) { return arr.filter(num => num % 2 === 0); }
easy
loops
5,627
Write a function that returns the sum of an array.
function sumArray(arr) { return arr.reduce((a, b) => a + b, 0); }
easy
arrays
5,628
Write a function that returns the factorial of a number.
function factorial(n) { if (n === 0) return 1; return n * factorial(n - 1); }
easy
math
5,629
Write a function that checks if a number is prime.
function isPrime(n) { if (n <= 1) return false; for (let i = 2; i * i <= n; i++) { if (n % i === 0) return false; } return true; }
medium
math
5,630
Write a function that finds even numbers in an array.
function findEven(arr) { return arr.filter(num => num % 2 === 0); }
easy
loops
5,631
Write a function that returns the factorial of a number.
function factorial(n) { if (n === 0) return 1; return n * factorial(n - 1); }
easy
math
5,632
Write a function that prints numbers from 1 to 100.
function printNumbers() { for (let i = 1; i <= 100; i++) { console.log(i); } }
medium
loops
5,633
Write a recursive function to sum an array.
function sumArrayRec(arr, index = 0) { if (index >= arr.length) return 0; return arr[index] + sumArrayRec(arr, index + 1); }
easy
recursion
5,634
Write a function that checks if a string is a palindrome.
function isPalindrome(s) { return s === s.split('').reverse().join(''); }
medium
strings
5,635
Write a function that checks if a string is a palindrome.
function isPalindrome(s) { return s === s.split('').reverse().join(''); }
easy
strings
5,636
Write a function that removes duplicates from an array.
function removeDuplicates(arr) { return [...new Set(arr)]; }
easy
arrays
5,637
Write a function that prints numbers from 1 to 100.
function printNumbers() { for (let i = 1; i <= 100; i++) { console.log(i); } }
easy
loops
5,638
Write a function that removes duplicates from an array.
function removeDuplicates(arr) { return [...new Set(arr)]; }
easy
arrays
5,639
Write a recursive function to sum an array.
function sumArrayRec(arr, index = 0) { if (index >= arr.length) return 0; return arr[index] + sumArrayRec(arr, index + 1); }
easy
recursion
5,640
Write a recursive function to sum an array.
function sumArrayRec(arr, index = 0) { if (index >= arr.length) return 0; return arr[index] + sumArrayRec(arr, index + 1); }
easy
recursion
5,641
Write a function that prints numbers from 1 to 100.
function printNumbers() { for (let i = 1; i <= 100; i++) { console.log(i); } }
medium
loops
5,642
Write a recursive function to compute Fibonacci numbers.
function fibonacci(n) { if (n <= 1) return n; return fibonacci(n - 1) + fibonacci(n - 2); }
hard
recursion
5,643
Write a recursive function to compute Fibonacci numbers.
function fibonacci(n) { if (n <= 1) return n; return fibonacci(n - 1) + fibonacci(n - 2); }
easy
recursion
5,644
Write a recursive function to compute Fibonacci numbers.
function fibonacci(n) { if (n <= 1) return n; return fibonacci(n - 1) + fibonacci(n - 2); }
easy
recursion
5,645
Write a function that removes duplicates from an array.
function removeDuplicates(arr) { return [...new Set(arr)]; }
easy
arrays
5,646
Write a function that returns the sum of an array.
function sumArray(arr) { return arr.reduce((a, b) => a + b, 0); }
medium
arrays
5,647
Write a function that checks if a string is a palindrome.
function isPalindrome(s) { return s === s.split('').reverse().join(''); }
easy
strings
5,648
Write a recursive function to sum an array.
function sumArrayRec(arr, index = 0) { if (index >= arr.length) return 0; return arr[index] + sumArrayRec(arr, index + 1); }
hard
recursion
5,649
Write a function that reverses a string.
function reverseString(s) { return s.split('').reverse().join(''); }
hard
strings
5,650
Write a function that returns the factorial of a number.
function factorial(n) { if (n === 0) return 1; return n * factorial(n - 1); }
medium
math
5,651
Write a function that reverses a string.
function reverseString(s) { return s.split('').reverse().join(''); }
easy
strings
5,652
Write a function that checks if a number is prime.
function isPrime(n) { if (n <= 1) return false; for (let i = 2; i * i <= n; i++) { if (n % i === 0) return false; } return true; }
medium
math
5,653
Write a function that reverses a string.
function reverseString(s) { return s.split('').reverse().join(''); }
easy
strings
5,654
Write a function that reverses a string.
function reverseString(s) { return s.split('').reverse().join(''); }
medium
strings
5,655
Write a function that returns the factorial of a number.
function factorial(n) { if (n === 0) return 1; return n * factorial(n - 1); }
medium
math
5,656
Write a function that finds even numbers in an array.
function findEven(arr) { return arr.filter(num => num % 2 === 0); }
easy
loops
5,657
Write a function that prints numbers from 1 to 100.
function printNumbers() { for (let i = 1; i <= 100; i++) { console.log(i); } }
easy
loops
5,658
Write a function that checks if a number is prime.
function isPrime(n) { if (n <= 1) return false; for (let i = 2; i * i <= n; i++) { if (n % i === 0) return false; } return true; }
hard
math
5,659
Write a function that reverses a string.
function reverseString(s) { return s.split('').reverse().join(''); }
hard
strings
5,660
Write a function that returns the sum of an array.
function sumArray(arr) { return arr.reduce((a, b) => a + b, 0); }
medium
arrays
5,661
Write a function that returns the sum of an array.
function sumArray(arr) { return arr.reduce((a, b) => a + b, 0); }
hard
arrays
5,662
Write a function that prints numbers from 1 to 100.
function printNumbers() { for (let i = 1; i <= 100; i++) { console.log(i); } }
easy
loops
5,663
Write a function that removes duplicates from an array.
function removeDuplicates(arr) { return [...new Set(arr)]; }
easy
arrays
5,664
Write a function that finds even numbers in an array.
function findEven(arr) { return arr.filter(num => num % 2 === 0); }
medium
loops
5,665
Write a function that returns the sum of an array.
function sumArray(arr) { return arr.reduce((a, b) => a + b, 0); }
easy
arrays
5,666
Write a function that returns the factorial of a number.
function factorial(n) { if (n === 0) return 1; return n * factorial(n - 1); }
easy
math
5,667
Write a function that checks if a number is prime.
function isPrime(n) { if (n <= 1) return false; for (let i = 2; i * i <= n; i++) { if (n % i === 0) return false; } return true; }
hard
math
5,668
Write a function that checks if a number is prime.
function isPrime(n) { if (n <= 1) return false; for (let i = 2; i * i <= n; i++) { if (n % i === 0) return false; } return true; }
medium
math
5,669
Write a function that checks if a number is prime.
function isPrime(n) { if (n <= 1) return false; for (let i = 2; i * i <= n; i++) { if (n % i === 0) return false; } return true; }
easy
math
5,670
Write a function that prints numbers from 1 to 100.
function printNumbers() { for (let i = 1; i <= 100; i++) { console.log(i); } }
easy
loops
5,671
Write a function that reverses a string.
function reverseString(s) { return s.split('').reverse().join(''); }
medium
strings
5,672
Write a function that checks if a string is a palindrome.
function isPalindrome(s) { return s === s.split('').reverse().join(''); }
easy
strings
5,673
Write a function that finds even numbers in an array.
function findEven(arr) { return arr.filter(num => num % 2 === 0); }
hard
loops
5,674
Write a function that returns the sum of an array.
function sumArray(arr) { return arr.reduce((a, b) => a + b, 0); }
medium
arrays
5,675
Write a function that checks if a number is prime.
function isPrime(n) { if (n <= 1) return false; for (let i = 2; i * i <= n; i++) { if (n % i === 0) return false; } return true; }
medium
math
5,676
Write a function that checks if a string is a palindrome.
function isPalindrome(s) { return s === s.split('').reverse().join(''); }
medium
strings
5,677
Write a function that finds even numbers in an array.
function findEven(arr) { return arr.filter(num => num % 2 === 0); }
medium
loops
5,678
Write a function that reverses a string.
function reverseString(s) { return s.split('').reverse().join(''); }
easy
strings
5,679
Write a function that removes duplicates from an array.
function removeDuplicates(arr) { return [...new Set(arr)]; }
easy
arrays
5,680
Write a recursive function to sum an array.
function sumArrayRec(arr, index = 0) { if (index >= arr.length) return 0; return arr[index] + sumArrayRec(arr, index + 1); }
easy
recursion
5,681
Write a function that returns the sum of an array.
function sumArray(arr) { return arr.reduce((a, b) => a + b, 0); }
easy
arrays
5,682
Write a function that returns the sum of an array.
function sumArray(arr) { return arr.reduce((a, b) => a + b, 0); }
easy
arrays
5,683
Write a function that checks if a number is prime.
function isPrime(n) { if (n <= 1) return false; for (let i = 2; i * i <= n; i++) { if (n % i === 0) return false; } return true; }
easy
math
5,684
Write a function that reverses a string.
function reverseString(s) { return s.split('').reverse().join(''); }
easy
strings
5,685
Write a recursive function to sum an array.
function sumArrayRec(arr, index = 0) { if (index >= arr.length) return 0; return arr[index] + sumArrayRec(arr, index + 1); }
medium
recursion
5,686
Write a function that checks if a string is a palindrome.
function isPalindrome(s) { return s === s.split('').reverse().join(''); }
easy
strings
5,687
Write a function that checks if a string is a palindrome.
function isPalindrome(s) { return s === s.split('').reverse().join(''); }
medium
strings
5,688
Write a function that returns the sum of an array.
function sumArray(arr) { return arr.reduce((a, b) => a + b, 0); }
medium
arrays
5,689
Write a recursive function to sum an array.
function sumArrayRec(arr, index = 0) { if (index >= arr.length) return 0; return arr[index] + sumArrayRec(arr, index + 1); }
easy
recursion
5,690
Write a function that removes duplicates from an array.
function removeDuplicates(arr) { return [...new Set(arr)]; }
easy
arrays
5,691
Write a function that checks if a number is prime.
function isPrime(n) { if (n <= 1) return false; for (let i = 2; i * i <= n; i++) { if (n % i === 0) return false; } return true; }
easy
math
5,692
Write a function that checks if a number is prime.
function isPrime(n) { if (n <= 1) return false; for (let i = 2; i * i <= n; i++) { if (n % i === 0) return false; } return true; }
medium
math
5,693
Write a function that finds even numbers in an array.
function findEven(arr) { return arr.filter(num => num % 2 === 0); }
medium
loops
5,694
Write a function that returns the factorial of a number.
function factorial(n) { if (n === 0) return 1; return n * factorial(n - 1); }
easy
math
5,695
Write a function that checks if a string is a palindrome.
function isPalindrome(s) { return s === s.split('').reverse().join(''); }
easy
strings
5,696
Write a function that finds even numbers in an array.
function findEven(arr) { return arr.filter(num => num % 2 === 0); }
easy
loops
5,697
Write a function that reverses a string.
function reverseString(s) { return s.split('').reverse().join(''); }
medium
strings
5,698
Write a function that returns the factorial of a number.
function factorial(n) { if (n === 0) return 1; return n * factorial(n - 1); }
easy
math
5,699
Write a function that prints numbers from 1 to 100.
function printNumbers() { for (let i = 1; i <= 100; i++) { console.log(i); } }
easy
loops
5,700
Write a recursive function to compute Fibonacci numbers.
function fibonacci(n) { if (n <= 1) return n; return fibonacci(n - 1) + fibonacci(n - 2); }
medium
recursion