id
int64
1
10k
question
stringclasses
10 values
solution
stringclasses
10 values
difficulty
stringclasses
3 values
topic
stringclasses
5 values
8,301
Write a function that finds even numbers in an array.
function findEven(arr) { return arr.filter(num => num % 2 === 0); }
easy
loops
8,302
Write a function that removes duplicates from an array.
function removeDuplicates(arr) { return [...new Set(arr)]; }
easy
arrays
8,303
Write a function that removes duplicates from an array.
function removeDuplicates(arr) { return [...new Set(arr)]; }
hard
arrays
8,304
Write a function that returns the sum of an array.
function sumArray(arr) { return arr.reduce((a, b) => a + b, 0); }
easy
arrays
8,305
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
8,306
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
8,307
Write a function that returns the sum of an array.
function sumArray(arr) { return arr.reduce((a, b) => a + b, 0); }
medium
arrays
8,308
Write a function that prints numbers from 1 to 100.
function printNumbers() { for (let i = 1; i <= 100; i++) { console.log(i); } }
easy
loops
8,309
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
8,310
Write a function that prints numbers from 1 to 100.
function printNumbers() { for (let i = 1; i <= 100; i++) { console.log(i); } }
medium
loops
8,311
Write a function that returns the sum of an array.
function sumArray(arr) { return arr.reduce((a, b) => a + b, 0); }
medium
arrays
8,312
Write a function that finds even numbers in an array.
function findEven(arr) { return arr.filter(num => num % 2 === 0); }
medium
loops
8,313
Write a function that reverses a string.
function reverseString(s) { return s.split('').reverse().join(''); }
easy
strings
8,314
Write a function that prints numbers from 1 to 100.
function printNumbers() { for (let i = 1; i <= 100; i++) { console.log(i); } }
medium
loops
8,315
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
8,316
Write a function that finds even numbers in an array.
function findEven(arr) { return arr.filter(num => num % 2 === 0); }
easy
loops
8,317
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
8,318
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
8,319
Write a function that reverses a string.
function reverseString(s) { return s.split('').reverse().join(''); }
medium
strings
8,320
Write a function that returns the sum of an array.
function sumArray(arr) { return arr.reduce((a, b) => a + b, 0); }
easy
arrays
8,321
Write a function that reverses a string.
function reverseString(s) { return s.split('').reverse().join(''); }
medium
strings
8,322
Write a function that checks if a string is a palindrome.
function isPalindrome(s) { return s === s.split('').reverse().join(''); }
easy
strings
8,323
Write a function that returns the sum of an array.
function sumArray(arr) { return arr.reduce((a, b) => a + b, 0); }
easy
arrays
8,324
Write a function that reverses a string.
function reverseString(s) { return s.split('').reverse().join(''); }
easy
strings
8,325
Write a function that reverses a string.
function reverseString(s) { return s.split('').reverse().join(''); }
medium
strings
8,326
Write a function that finds even numbers in an array.
function findEven(arr) { return arr.filter(num => num % 2 === 0); }
medium
loops
8,327
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
8,328
Write a function that checks if a string is a palindrome.
function isPalindrome(s) { return s === s.split('').reverse().join(''); }
hard
strings
8,329
Write a function that prints numbers from 1 to 100.
function printNumbers() { for (let i = 1; i <= 100; i++) { console.log(i); } }
hard
loops
8,330
Write a function that checks if a string is a palindrome.
function isPalindrome(s) { return s === s.split('').reverse().join(''); }
hard
strings
8,331
Write a function that returns the sum of an array.
function sumArray(arr) { return arr.reduce((a, b) => a + b, 0); }
easy
arrays
8,332
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
8,333
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
8,334
Write a function that removes duplicates from an array.
function removeDuplicates(arr) { return [...new Set(arr)]; }
easy
arrays
8,335
Write a function that finds even numbers in an array.
function findEven(arr) { return arr.filter(num => num % 2 === 0); }
medium
loops
8,336
Write a function that checks if a string is a palindrome.
function isPalindrome(s) { return s === s.split('').reverse().join(''); }
easy
strings
8,337
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
8,338
Write a function that reverses a string.
function reverseString(s) { return s.split('').reverse().join(''); }
medium
strings
8,339
Write a function that prints numbers from 1 to 100.
function printNumbers() { for (let i = 1; i <= 100; i++) { console.log(i); } }
easy
loops
8,340
Write a function that checks if a string is a palindrome.
function isPalindrome(s) { return s === s.split('').reverse().join(''); }
easy
strings
8,341
Write a function that returns the sum of an array.
function sumArray(arr) { return arr.reduce((a, b) => a + b, 0); }
medium
arrays
8,342
Write a function that checks if a string is a palindrome.
function isPalindrome(s) { return s === s.split('').reverse().join(''); }
medium
strings
8,343
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
8,344
Write a function that returns the sum of an array.
function sumArray(arr) { return arr.reduce((a, b) => a + b, 0); }
hard
arrays
8,345
Write a function that checks if a string is a palindrome.
function isPalindrome(s) { return s === s.split('').reverse().join(''); }
medium
strings
8,346
Write a function that reverses a string.
function reverseString(s) { return s.split('').reverse().join(''); }
medium
strings
8,347
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
8,348
Write a function that prints numbers from 1 to 100.
function printNumbers() { for (let i = 1; i <= 100; i++) { console.log(i); } }
easy
loops
8,349
Write a function that returns the sum of an array.
function sumArray(arr) { return arr.reduce((a, b) => a + b, 0); }
medium
arrays
8,350
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
8,351
Write a function that removes duplicates from an array.
function removeDuplicates(arr) { return [...new Set(arr)]; }
easy
arrays
8,352
Write a function that returns the sum of an array.
function sumArray(arr) { return arr.reduce((a, b) => a + b, 0); }
easy
arrays
8,353
Write a function that returns the sum of an array.
function sumArray(arr) { return arr.reduce((a, b) => a + b, 0); }
medium
arrays
8,354
Write a function that returns the sum of an array.
function sumArray(arr) { return arr.reduce((a, b) => a + b, 0); }
medium
arrays
8,355
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
8,356
Write a function that checks if a string is a palindrome.
function isPalindrome(s) { return s === s.split('').reverse().join(''); }
hard
strings
8,357
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
8,358
Write a function that finds even numbers in an array.
function findEven(arr) { return arr.filter(num => num % 2 === 0); }
easy
loops
8,359
Write a function that checks if a string is a palindrome.
function isPalindrome(s) { return s === s.split('').reverse().join(''); }
easy
strings
8,360
Write a function that checks if a string is a palindrome.
function isPalindrome(s) { return s === s.split('').reverse().join(''); }
easy
strings
8,361
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
8,362
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
8,363
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
8,364
Write a function that checks if a string is a palindrome.
function isPalindrome(s) { return s === s.split('').reverse().join(''); }
medium
strings
8,365
Write a function that finds even numbers in an array.
function findEven(arr) { return arr.filter(num => num % 2 === 0); }
easy
loops
8,366
Write a function that prints numbers from 1 to 100.
function printNumbers() { for (let i = 1; i <= 100; i++) { console.log(i); } }
hard
loops
8,367
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
8,368
Write a function that removes duplicates from an array.
function removeDuplicates(arr) { return [...new Set(arr)]; }
medium
arrays
8,369
Write a function that returns the sum of an array.
function sumArray(arr) { return arr.reduce((a, b) => a + b, 0); }
easy
arrays
8,370
Write a function that returns the sum of an array.
function sumArray(arr) { return arr.reduce((a, b) => a + b, 0); }
medium
arrays
8,371
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
8,372
Write a function that removes duplicates from an array.
function removeDuplicates(arr) { return [...new Set(arr)]; }
easy
arrays
8,373
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
8,374
Write a function that returns the sum of an array.
function sumArray(arr) { return arr.reduce((a, b) => a + b, 0); }
medium
arrays
8,375
Write a function that checks if a string is a palindrome.
function isPalindrome(s) { return s === s.split('').reverse().join(''); }
easy
strings
8,376
Write a function that checks if a string is a palindrome.
function isPalindrome(s) { return s === s.split('').reverse().join(''); }
easy
strings
8,377
Write a function that prints numbers from 1 to 100.
function printNumbers() { for (let i = 1; i <= 100; i++) { console.log(i); } }
easy
loops
8,378
Write a function that removes duplicates from an array.
function removeDuplicates(arr) { return [...new Set(arr)]; }
easy
arrays
8,379
Write a function that prints numbers from 1 to 100.
function printNumbers() { for (let i = 1; i <= 100; i++) { console.log(i); } }
medium
loops
8,380
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
8,381
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
8,382
Write a function that reverses a string.
function reverseString(s) { return s.split('').reverse().join(''); }
easy
strings
8,383
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
8,384
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
8,385
Write a function that finds even numbers in an array.
function findEven(arr) { return arr.filter(num => num % 2 === 0); }
easy
loops
8,386
Write a function that prints numbers from 1 to 100.
function printNumbers() { for (let i = 1; i <= 100; i++) { console.log(i); } }
hard
loops
8,387
Write a function that prints numbers from 1 to 100.
function printNumbers() { for (let i = 1; i <= 100; i++) { console.log(i); } }
medium
loops
8,388
Write a function that returns the sum of an array.
function sumArray(arr) { return arr.reduce((a, b) => a + b, 0); }
easy
arrays
8,389
Write a function that prints numbers from 1 to 100.
function printNumbers() { for (let i = 1; i <= 100; i++) { console.log(i); } }
medium
loops
8,390
Write a function that prints numbers from 1 to 100.
function printNumbers() { for (let i = 1; i <= 100; i++) { console.log(i); } }
medium
loops
8,391
Write a function that returns the sum of an array.
function sumArray(arr) { return arr.reduce((a, b) => a + b, 0); }
easy
arrays
8,392
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
8,393
Write a function that returns the sum of an array.
function sumArray(arr) { return arr.reduce((a, b) => a + b, 0); }
easy
arrays
8,394
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
8,395
Write a function that removes duplicates from an array.
function removeDuplicates(arr) { return [...new Set(arr)]; }
medium
arrays
8,396
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
8,397
Write a function that removes duplicates from an array.
function removeDuplicates(arr) { return [...new Set(arr)]; }
hard
arrays
8,398
Write a function that reverses a string.
function reverseString(s) { return s.split('').reverse().join(''); }
easy
strings
8,399
Write a function that checks if a string is a palindrome.
function isPalindrome(s) { return s === s.split('').reverse().join(''); }
medium
strings
8,400
Write a function that removes duplicates from an array.
function removeDuplicates(arr) { return [...new Set(arr)]; }
medium
arrays