chosen listlengths 2 2 | rejected listlengths 2 2 | score_chosen int64 6 9 | score_rejected int64 1 9 |
|---|---|---|---|
[
{
"content": "Please write a function in JavaScript to count the number of vowels in a given string. However, you are not allowed to use any built-in string methods or regular expressions. The input string may contain lowercase and/or uppercase alphabets, as well as special characters and numbers. The function ... | [
{
"content": "Please write a function in JavaScript to count the number of vowels in a given string. However, you are not allowed to use any built-in string methods or regular expressions. The input string may contain lowercase and/or uppercase alphabets, as well as special characters and numbers. The function ... | 9 | 1 |
[
{
"content": "Sum up all the prime numbers in the array, excluding the number 3, using JavaScript. The array should have a minimum length of 15 and a maximum length of 25.",
"role": "user"
},
{
"content": "Here's one possible solution in JavaScript:\n\n```javascriptfunction a0_0x488f(_0x5adf42, _0x1... | [
{
"content": "Sum up all the prime numbers in the array, excluding the number 3, using JavaScript. The array should have a minimum length of 15 and a maximum length of 25.",
"role": "user"
},
{
"content": "Here's one possible solution in JavaScript:\n\n```javascript\nfunction sumPrimes(arr) {\n // ... | 9 | 3 |
[
{
"content": "Write a JavaScript code to get the current browser URL and display it on the webpage, but without using the built-in location object.\n\nAdditional Requirements:\n1. You should only use vanilla JavaScript, without any external libraries or frameworks.\n2. The code should work in all major browsers... | [
{
"content": "Write a JavaScript code to get the current browser URL and display it on the webpage, but without using the built-in location object.\n\nAdditional Requirements:\n1. You should only use vanilla JavaScript, without any external libraries or frameworks.\n2. The code should work in all major browsers... | 6 | 2 |
[
{
"content": "Write a JavaScript function that takes in an array of numbers and returns the sum of all the even numbers in the array. Additionally, the function should ignore any duplicate numbers in the array and only consider the unique even numbers for the sum calculation. The function should also handle neg... | [
{
"content": "Write a JavaScript function that takes in an array of numbers and returns the sum of all the even numbers in the array. Additionally, the function should ignore any duplicate numbers in the array and only consider the unique even numbers for the sum calculation. The function should also handle neg... | 9 | 9 |
[
{
"content": "Create a function in JavaScript that takes an array of integers and returns the second largest number. However, you are not allowed to use any built-in sorting methods or loops like for, while, or forEach. You need to come up with an alternative solution that uses only logical steps and conditiona... | [
{
"content": "Create a function in JavaScript that takes an array of integers and returns the second largest number. However, you are not allowed to use any built-in sorting methods or loops like for, while, or forEach. You need to come up with an alternative solution that uses only logical steps and conditiona... | 8 | 8 |
[
{
"content": "Create a webpage that consists of an HTML form with the following components: a textbox, a submit button, and two radio buttons. \n\n1. The textbox should have the following validation rules:\n - Only allow alphanumeric characters\n - Do not allow the textbox to be empty when the submit button... | [
{
"content": "Create a webpage that consists of an HTML form with the following components: a textbox, a submit button, and two radio buttons. \n\n1. The textbox should have the following validation rules:\n - Only allow alphanumeric characters\n - Do not allow the textbox to be empty when the submit button... | 8 | 1 |
[
{
"content": "Create a JavaScript function which takes a string as a parameter and returns the most frequent character in the string. The function should handle uppercase and lowercase characters as the same. The string can contain special characters, spaces, and numbers. If there are multiple characters with t... | [
{
"content": "Create a JavaScript function which takes a string as a parameter and returns the most frequent character in the string. The function should handle uppercase and lowercase characters as the same. The string can contain special characters, spaces, and numbers. If there are multiple characters with t... | 6 | 6 |
[
{
"content": "Create a JavaScript program which takes an array of integers as a parameter and reverses the array in-place. The program should return the reversed array without using any built-in methods like `reverse()`. Additionally, the program should handle cases where the input array is empty or contains no... | [
{
"content": "Create a JavaScript program which takes an array of integers as a parameter and reverses the array in-place. The program should return the reversed array without using any built-in methods like `reverse()`. Additionally, the program should handle cases where the input array is empty or contains no... | 6 | 6 |
[
{
"content": "Write a JavaScript function that takes in an array of positive integers and removes the last element from the array without using any built-in methods like .pop() or .slice(). Then, calculate the sum of the remaining elements in the array and find the second smallest value in the array. Your funct... | [
{
"content": "Write a JavaScript function that takes in an array of positive integers and removes the last element from the array without using any built-in methods like .pop() or .slice(). Then, calculate the sum of the remaining elements in the array and find the second smallest value in the array. Your funct... | 7 | 4 |
[
{
"content": "Write a JavaScript function to capitalize the first letter of each word in a string. Additionally, convert all lowercase letters to uppercase and all uppercase letters to lowercase for all other characters in the string. If a word starts with a vowel, capitalize the entire word. If a word ends wit... | [
{
"content": "Write a JavaScript function to capitalize the first letter of each word in a string. Additionally, convert all lowercase letters to uppercase and all uppercase letters to lowercase for all other characters in the string. If a word starts with a vowel, capitalize the entire word. If a word ends wit... | 7 | 1 |
[
{
"content": "Create a JavaScript function that finds the shortest word in a string, excluding words that contain any uppercase letters or special characters. The function should return the shortest word that is longer than 3 characters, has at least one vowel, and has a consonant-vowel-consonant pattern. The s... | [
{
"content": "Create a JavaScript function that finds the shortest word in a string, excluding words that contain any uppercase letters or special characters. The function should return the shortest word that is longer than 3 characters, has at least one vowel, and has a consonant-vowel-consonant pattern. The s... | 9 | 9 |
[
{
"content": "Write a JavaScript code to calculate the factorial of a number. The code should handle negative numbers as input and return an error message for negative input. Additionally, the code should handle decimal numbers as input and return an error message for decimal input. The code should also handle ... | [
{
"content": "Write a JavaScript code to calculate the factorial of a number. The code should handle negative numbers as input and return an error message for negative input. Additionally, the code should handle decimal numbers as input and return an error message for decimal input. The code should also handle ... | 8 | 8 |
[
{
"content": "Write a JavaScript code to validate a password based on the following rules:\n\n1. The password must be at least 16 characters long.\n2. The password must contain at least two uppercase letters and two lowercase letters.\n3. The password must contain at least two special characters (!@#$%^&*).\n4.... | [
{
"content": "Write a JavaScript code to validate a password based on the following rules:\n\n1. The password must be at least 16 characters long.\n2. The password must contain at least two uppercase letters and two lowercase letters.\n3. The password must contain at least two special characters (!@#$%^&*).\n4.... | 8 | 3 |
[
{
"content": "Create a JavaScript function that takes a given paragraph as a parameter and capitalizes the first letter of each sentence. Additionally, the function should ignore any sentences that contain numbers or special characters. The paragraph should be at least 10 sentences long and the function should ... | [
{
"content": "Create a JavaScript function that takes a given paragraph as a parameter and capitalizes the first letter of each sentence. Additionally, the function should ignore any sentences that contain numbers or special characters. The paragraph should be at least 10 sentences long and the function should ... | 7 | 7 |
[
{
"content": "Write a Javascript code to check if the given number is a prime number. Additionally, the code should also check if the number is a perfect square and a palindrome. The code should have a time complexity of O(sqrt(n)) for prime number checking and a space complexity of O(1).",
"role": "user"
... | [
{
"content": "Write a Javascript code to check if the given number is a prime number. Additionally, the code should also check if the number is a perfect square and a palindrome. The code should have a time complexity of O(sqrt(n)) for prime number checking and a space complexity of O(1).",
"role": "user"
... | 6 | 6 |
[
{
"content": "Create a JavaScript function that takes an array of positive integers and returns the kth smallest prime number from the array, where k is an input parameter to the function. However, the function should only iterate through the array once and should not use any built-in JavaScript functions to ch... | [
{
"content": "Create a JavaScript function that takes an array of positive integers and returns the kth smallest prime number from the array, where k is an input parameter to the function. However, the function should only iterate through the array once and should not use any built-in JavaScript functions to ch... | 9 | 1 |
[
{
"content": "Write a JavaScript function to check if an array contains a specific element and return the index of that element. If the element is not found, return -1. The array can contain both numbers and strings. The function should have a time complexity of O(n), where n is the number of elements in the ar... | [
{
"content": "Write a JavaScript function to check if an array contains a specific element and return the index of that element. If the element is not found, return -1. The array can contain both numbers and strings. The function should have a time complexity of O(n), where n is the number of elements in the ar... | 8 | 8 |
[
{
"content": "Implement a function in JavaScript to calculate the median of all elements in an array. The array may contain positive and negative integers, as well as decimal numbers. The length of the array can vary from 1 to 1,000,000 elements. Your solution should have a time complexity of O(n log n) and a s... | [
{
"content": "Implement a function in JavaScript to calculate the median of all elements in an array. The array may contain positive and negative integers, as well as decimal numbers. The length of the array can vary from 1 to 1,000,000 elements. Your solution should have a time complexity of O(n log n) and a s... | 8 | 8 |
[
{
"content": "Write a JS program that takes a number n and prints out the first n Fibonacci numbers in reverse order. Ensure that the program includes error handling for invalid input, such as non-numeric values or negative numbers.\n\nAdditionally, implement the program in a way that avoids calculating the Fib... | [
{
"content": "Write a JS program that takes a number n and prints out the first n Fibonacci numbers in reverse order. Ensure that the program includes error handling for invalid input, such as non-numeric values or negative numbers.\n\nAdditionally, implement the program in a way that avoids calculating the Fib... | 6 | 6 |
[
{
"content": "Construct a switch statement to log different grade messages based on the grade variable. The grade variable can only contain the following values: \"A+\", \"A\", \"B\", \"C\", \"D\", \"F\". Additionally, each grade value should have a specific range associated with it as follows: \n- \"A+\": 90-1... | [
{
"content": "Construct a switch statement to log different grade messages based on the grade variable. The grade variable can only contain the following values: \"A+\", \"A\", \"B\", \"C\", \"D\", \"F\". Additionally, each grade value should have a specific range associated with it as follows: \n- \"A+\": 90-1... | 6 | 2 |
[
{
"content": "Write a JavaScript code to print the first 1000 terms of the Fibonacci series, but exclude any terms that are divisible by both 3 and 5. Additionally, calculate and print the sum of the remaining terms.",
"role": "user"
},
{
"content": "Here's the JavaScript code to print the first 100... | [
{
"content": "Write a JavaScript code to print the first 1000 terms of the Fibonacci series, but exclude any terms that are divisible by both 3 and 5. Additionally, calculate and print the sum of the remaining terms.",
"role": "user"
},
{
"content": "Here's the JavaScript code to print the first 100... | 8 | 2 |
[
{
"content": "Increase the difficulty of the test by requiring the use of hooks instead of functional components.\n\n#Rewritten Test#\nImprove the following React component to render a link with the text \"Visit us Here\". When the link is clicked, it should display an alert with the message \"You have visited ... | [
{
"content": "Increase the difficulty of the test by requiring the use of hooks instead of functional components.\n\n#Rewritten Test#\nImprove the following React component to render a link with the text \"Visit us Here\". When the link is clicked, it should display an alert with the message \"You have visited ... | 9 | 9 |
[
{
"content": "Write a JavaScript code to eliminate any symbols, numbers, and whitespace characters from a given string, while retaining the order of the remaining characters. Additionally, convert all uppercase letters to lowercase, remove any duplicate characters from the resulting string, and reverse the orde... | [
{
"content": "Write a JavaScript code to eliminate any symbols, numbers, and whitespace characters from a given string, while retaining the order of the remaining characters. Additionally, convert all uppercase letters to lowercase, remove any duplicate characters from the resulting string, and reverse the orde... | 7 | 7 |
[
{
"content": "Write a JavaScript code to check if a string is a valid email address, while also verifying the domain name and top-level domain (TLD) format.\n\nA valid email address should meet the following conditions:\n1. It must have a username part before the \"@\" symbol.\n2. The username part can contain ... | [
{
"content": "Write a JavaScript code to check if a string is a valid email address, while also verifying the domain name and top-level domain (TLD) format.\n\nA valid email address should meet the following conditions:\n1. It must have a username part before the \"@\" symbol.\n2. The username part can contain ... | 8 | 8 |
[
{
"content": "Create a new array in JavaScript containing only prime numbers from the given input array. The input array may contain duplicates and negative numbers.\n\nAdditional Requirements:\n1. Implement a function that checks if a number is a perfect square.\n2. Use the Sieve of Eratosthenes algorithm to f... | [
{
"content": "Create a new array in JavaScript containing only prime numbers from the given input array. The input array may contain duplicates and negative numbers.\n\nAdditional Requirements:\n1. Implement a function that checks if a number is a perfect square.\n2. Use the Sieve of Eratosthenes algorithm to f... | 9 | 9 |
[
{
"content": "Create a program in JavaScript to check if two strings are anagrams. Additionally, implement a function to remove all duplicates from a string before checking if it is an anagram. The program should also handle cases where the strings may contain non-alphabetic characters and should be case-insens... | [
{
"content": "Create a program in JavaScript to check if two strings are anagrams. Additionally, implement a function to remove all duplicates from a string before checking if it is an anagram. The program should also handle cases where the strings may contain non-alphabetic characters and should be case-insens... | 7 | 2 |
[
{
"content": "Write a function in JavaScript that takes an integer n and returns the nth Fibonacci number. However, you are not allowed to use recursion or the built-in Fibonacci formula to calculate the number. Additionally, your function should have a time complexity of O(n) and should not use any additional ... | [
{
"content": "Write a function in JavaScript that takes an integer n and returns the nth Fibonacci number. However, you are not allowed to use recursion or the built-in Fibonacci formula to calculate the number. Additionally, your function should have a time complexity of O(n) and should not use any additional ... | 7 | 4 |
[
{
"content": "Given a string and a set of delimiters, write a function in JavaScript to split the string. The function should split the string at the delimiters if they are followed by a space, a punctuation mark, or a capital letter. The delimiters should not be included in the resulting array. Additionally, t... | [
{
"content": "Given a string and a set of delimiters, write a function in JavaScript to split the string. The function should split the string at the delimiters if they are followed by a space, a punctuation mark, or a capital letter. The delimiters should not be included in the resulting array. Additionally, t... | 8 | 3 |
[
{
"content": "Given the following object, write a function in JavaScript to count the occurrences of each character in the object's values. The function should also remove any duplicate characters from the count. Additionally, the function should handle values that are arrays, strings, or nested objects.\n\nobj... | [
{
"content": "Given the following object, write a function in JavaScript to count the occurrences of each character in the object's values. The function should also remove any duplicate characters from the count. Additionally, the function should handle values that are arrays, strings, or nested objects.\n\nobj... | 7 | 7 |
[
{
"content": "Create a responsive HTML page with 3 sections, using div tags. Each section should contain at least 3 different elements, such as images, paragraphs, and links. Additionally, implement a JavaScript function that not only changes the background color of each section when a button is clicked, but al... | [
{
"content": "Create a responsive HTML page with 3 sections, using div tags. Each section should contain at least 3 different elements, such as images, paragraphs, and links. Additionally, implement a JavaScript function that not only changes the background color of each section when a button is clicked, but al... | 9 | 9 |
[
{
"content": "Use JavaScript to filter an array of numbers such that only prime numbers are returned. If the number is even, it should be skipped. If the number is negative, it should be considered as a prime number. If the number is a decimal, it should be rounded up to the nearest integer before checking if i... | [
{
"content": "Use JavaScript to filter an array of numbers such that only prime numbers are returned. If the number is even, it should be skipped. If the number is negative, it should be considered as a prime number. If the number is a decimal, it should be rounded up to the nearest integer before checking if i... | 8 | 3 |
[
{
"content": "Create an object in JavaScript that performs a task given a condition, where the condition is that the object must be able to handle and process asynchronous tasks and callbacks. Additionally, the object must be implemented using a functional programming approach, without using any classes or obje... | [
{
"content": "Create an object in JavaScript that performs a task given a condition, where the condition is that the object must be able to handle and process asynchronous tasks and callbacks. Additionally, the object must be implemented using a functional programming approach, without using any classes or obje... | 8 | 1 |
[
{
"content": "Create an HTML form with three input boxes and a submit button. Upon submission, validate the input values using JavaScript to ensure that:\n- The first input box should only accept numeric values greater than or equal to 500 and less than or equal to 2000.\n- The second input box should only acce... | [
{
"content": "Create an HTML form with three input boxes and a submit button. Upon submission, validate the input values using JavaScript to ensure that:\n- The first input box should only accept numeric values greater than or equal to 500 and less than or equal to 2000.\n- The second input box should only acce... | 9 | 9 |
[
{
"content": "Write a JavaScript function to check whether a given number is a prime number or not. The input number will always be greater than 1 and less than 10^12.",
"role": "user"
},
{
"content": "Here is a JavaScript function that checks whether a given number is a prime number or not:\n\n```j... | [
{
"content": "Write a JavaScript function to check whether a given number is a prime number or not. The input number will always be greater than 1 and less than 10^12.",
"role": "user"
},
{
"content": "Here is a JavaScript function that checks whether a given number is a prime number or not:\n\n```j... | 7 | 7 |
[
{
"content": "Create a self-balancing binary search tree in JavaScript with the following additional requirements:\n\n1. Each node in the tree should store both a key and a value. The key should be a unique identifier for the node, and the value can be any data type.\n2. The tree should support insertion, delet... | [
{
"content": "Create a self-balancing binary search tree in JavaScript with the following additional requirements:\n\n1. Each node in the tree should store both a key and a value. The key should be a unique identifier for the node, and the value can be any data type.\n2. The tree should support insertion, delet... | 6 | 6 |
[
{
"content": "Create a JavaScript function that prints out the numbers from 1 to n, but only if the number is divisible by both 3 and 5. Additionally, the function should also print out a message stating if the number is prime or not.",
"role": "user"
},
{
"content": "Here's a JavaScript function th... | [
{
"content": "Create a JavaScript function that prints out the numbers from 1 to n, but only if the number is divisible by both 3 and 5. Additionally, the function should also print out a message stating if the number is prime or not.",
"role": "user"
},
{
"content": "Here's a JavaScript function th... | 9 | 9 |
[
{
"content": "Write a JavaScript function to sort an array of integers in ascending order, without using any built-in sorting functions or methods. The function should also handle negative numbers, duplicates, and floating-point numbers in the array, and return the sorted array. Additionally, the function shoul... | [
{
"content": "Write a JavaScript function to sort an array of integers in ascending order, without using any built-in sorting functions or methods. The function should also handle negative numbers, duplicates, and floating-point numbers in the array, and return the sorted array. Additionally, the function shoul... | 8 | 2 |
[
{
"content": "Create an array of the numbers from 1 to 10, ensuring that the array is sorted in descending order and all even numbers are placed before odd numbers. Additionally, write a function to reverse the elements in the array without using any built-in functions or methods and without using any extra spa... | [
{
"content": "Create an array of the numbers from 1 to 10, ensuring that the array is sorted in descending order and all even numbers are placed before odd numbers. Additionally, write a function to reverse the elements in the array without using any built-in functions or methods and without using any extra spa... | 9 | 9 |
[
{
"content": "Write a JavaScript function that detects the browser language and displays a response message in that language. The function should also allow the user to specify a default language in case the browser language is not supported. Additionally, the function should handle cases where the browser lang... | [
{
"content": "Write a JavaScript function that detects the browser language and displays a response message in that language. The function should also allow the user to specify a default language in case the browser language is not supported. Additionally, the function should handle cases where the browser lang... | 7 | 7 |
[
{
"content": "Write a script in JavaScript to parse an XML document and extract specific data elements based on a set of complex conditions. The script should handle any errors that may occur during the parsing process and provide appropriate error messages. Additionally, the script should implement a caching m... | [
{
"content": "Write a script in JavaScript to parse an XML document and extract specific data elements based on a set of complex conditions. The script should handle any errors that may occur during the parsing process and provide appropriate error messages. Additionally, the script should implement a caching m... | 8 | 8 |
[
{
"content": "Write a JavaScript function that takes in a string and returns the string with each word reversed. The function should also remove any duplicate words from the string and return the result in reverse alphabetical order. Additionally, if the input string contains any special characters, the functio... | [
{
"content": "Write a JavaScript function that takes in a string and returns the string with each word reversed. The function should also remove any duplicate words from the string and return the result in reverse alphabetical order. Additionally, if the input string contains any special characters, the functio... | 8 | 3 |
[
{
"content": "Write a JavaScript function that takes in a string and returns a new string where every word is capitalized and the words are separated by a hyphen. Use only pure JavaScript (no built-in methods such as .toUpperCase() or .split() allowed).\n\nIn addition, ensure that the function:\n- Ignores leadi... | [
{
"content": "Write a JavaScript function that takes in a string and returns a new string where every word is capitalized and the words are separated by a hyphen. Use only pure JavaScript (no built-in methods such as .toUpperCase() or .split() allowed).\n\nIn addition, ensure that the function:\n- Ignores leadi... | 9 | 9 |
[
{
"content": "Edit the following JavaScript code to reverse the characters of a given string. The code should not use any built-in string reversal functions or methods, and should be done using a recursive function.\n\n```javascript\nfunction reverseString(str) {\n if (str === \"\") {\n return \"\";\n } el... | [
{
"content": "Edit the following JavaScript code to reverse the characters of a given string. The code should not use any built-in string reversal functions or methods, and should be done using a recursive function.\n\n```javascript\nfunction reverseString(str) {\n if (str === \"\") {\n return \"\";\n } el... | 8 | 8 |
[
{
"content": "Write a JavaScript code to add two numbers using a prompt, but instead of adding two numbers directly, create a recursive function that takes in two numbers as parameters and returns their sum. Additionally, the function should check if either of the input numbers is negative, and if so, convert i... | [
{
"content": "Write a JavaScript code to add two numbers using a prompt, but instead of adding two numbers directly, create a recursive function that takes in two numbers as parameters and returns their sum. Additionally, the function should check if either of the input numbers is negative, and if so, convert i... | 8 | 8 |
[
{
"content": "Create a function in JavaScript to check if an array is empty. Additionally, the function should also return true if the array contains only falsy values, such as undefined, null, 0, false, NaN, or an empty string. The function should ignore any whitespace characters within the array elements and ... | [
{
"content": "Create a function in JavaScript to check if an array is empty. Additionally, the function should also return true if the array contains only falsy values, such as undefined, null, 0, false, NaN, or an empty string. The function should ignore any whitespace characters within the array elements and ... | 9 | 9 |
[
{
"content": "Modify the given HTML code to create a form element with two text boxes, a select dropdown, a checkbox, and a submit button. The select dropdown should contain at least five options, and the checkbox should have a label associated with it. Additionally, the form should include client-side validati... | [
{
"content": "Modify the given HTML code to create a form element with two text boxes, a select dropdown, a checkbox, and a submit button. The select dropdown should contain at least five options, and the checkbox should have a label associated with it. Additionally, the form should include client-side validati... | 8 | 8 |
[
{
"content": "Write a function in JavaScript that takes in an array as input and swaps the first and last elements. The array should contain at least 10 elements. Additionally, you need to reverse the order of the elements in between the first and last elements. The function should have a time complexity of O(n... | [
{
"content": "Write a function in JavaScript that takes in an array as input and swaps the first and last elements. The array should contain at least 10 elements. Additionally, you need to reverse the order of the elements in between the first and last elements. The function should have a time complexity of O(n... | 6 | 1 |
[
{
"content": "Implement a method in JavaScript that checks if a String is a palindrome. A palindrome is a word, phrase, number, or other sequence of characters that reads the same forward and backward. The method should return true if the String is a palindrome and false otherwise. The method should ignore any ... | [
{
"content": "Implement a method in JavaScript that checks if a String is a palindrome. A palindrome is a word, phrase, number, or other sequence of characters that reads the same forward and backward. The method should return true if the String is a palindrome and false otherwise. The method should ignore any ... | 9 | 9 |
[
{
"content": "Create an HTML form with three text fields—name, age, and gender. Upon submitting the form, validate the inputs and display appropriate error messages if any of the following conditions are not met:\n1. The name field cannot be empty and should contain only alphabetic characters. The name should a... | [
{
"content": "Create an HTML form with three text fields—name, age, and gender. Upon submitting the form, validate the inputs and display appropriate error messages if any of the following conditions are not met:\n1. The name field cannot be empty and should contain only alphabetic characters. The name should a... | 8 | 2 |
[
{
"content": "Write a JavaScript function that takes an array of strings and returns true if the strings are in lexicographically sorted order. The function should also account for case sensitivity.\n\nFor example, given the array:\narray = [\"apple\", \"boy\", \"Cat\", \"dog\"]\n\nThe function should return fa... | [
{
"content": "Write a JavaScript function that takes an array of strings and returns true if the strings are in lexicographically sorted order. The function should also account for case sensitivity.\n\nFor example, given the array:\narray = [\"apple\", \"boy\", \"Cat\", \"dog\"]\n\nThe function should return fa... | 6 | 6 |
[
{
"content": "Please create a JSON object from the following data provided, where each data entry is represented as a separate object within an array:\n1. Name: John Smith, Age: 34, Country: US\n2. Name: Jane Doe, Age: 28, Country: Canada\n3. Name: Alex Johnson, Age: 42, Country: UK\n\nYou are required to valid... | [
{
"content": "Please create a JSON object from the following data provided, where each data entry is represented as a separate object within an array:\n1. Name: John Smith, Age: 34, Country: US\n2. Name: Jane Doe, Age: 28, Country: Canada\n3. Name: Alex Johnson, Age: 42, Country: UK\n\nYou are required to valid... | 9 | 9 |
[
{
"content": "Design an algorithm to find the shortest path in a maze using JavaScript, but you are not allowed to use any graph traversal algorithms such as Breadth First Search or Dijkstra's algorithm. Additionally, you are not allowed to use any built-in data structures or libraries for maze representation o... | [
{
"content": "Design an algorithm to find the shortest path in a maze using JavaScript, but you are not allowed to use any graph traversal algorithms such as Breadth First Search or Dijkstra's algorithm. Additionally, you are not allowed to use any built-in data structures or libraries for maze representation o... | 7 | 7 |
[
{
"content": "Please write a program to create a JavaScript function that is used to validate an email address. The function should check if the email address is in the correct format, contains a valid domain name, and also verify if the domain has a valid MX record. Additionally, the program should handle emai... | [
{
"content": "Please write a program to create a JavaScript function that is used to validate an email address. The function should check if the email address is in the correct format, contains a valid domain name, and also verify if the domain has a valid MX record. Additionally, the program should handle emai... | 8 | 3 |
[
{
"content": "Create a JavaScript function that converts all the characters in a string to uppercase, while also reversing the order of the characters in the string. Additionally, the function should remove any duplicate characters in the string before performing the conversion and reversal. However, the functi... | [
{
"content": "Create a JavaScript function that converts all the characters in a string to uppercase, while also reversing the order of the characters in the string. Additionally, the function should remove any duplicate characters in the string before performing the conversion and reversal. However, the functi... | 7 | 7 |
[
{
"content": "Generate a random 4-digit number that is divisible by both 7 and 9 using JavaScript.",
"role": "user"
},
{
"content": "To generate a random 4-digit number that is divisible by both 7 and 9 in JavaScript, you can use the following code:\n\n```javascript\nfunction generateRandomNumber() ... | [
{
"content": "Generate a random 4-digit number that is divisible by both 7 and 9 using JavaScript.",
"role": "user"
},
{
"content": "To generate a random 4-digit number that is divisible by both 7 and 9 in JavaScript, you can use the following code:\n\n```javascript\nfunction generateRandomNumber() ... | 7 | 7 |
[
{
"content": "Write a JavaScript function that simulates the behavior of a Promise without using the built-in Promise class. The function should accept two arguments: a resolve callback and a reject callback. The resolve callback should be invoked with a value as an argument when the asynchronous operation is s... | [
{
"content": "Write a JavaScript function that simulates the behavior of a Promise without using the built-in Promise class. The function should accept two arguments: a resolve callback and a reject callback. The resolve callback should be invoked with a value as an argument when the asynchronous operation is s... | 8 | 8 |
[
{
"content": "Write a JavaScript function that takes an array of strings as input and returns an object containing the frequency count of each unique string in the array. The function should only count strings that are at least 3 characters long and contain only alphabetical characters. If the input array is em... | [
{
"content": "Write a JavaScript function that takes an array of strings as input and returns an object containing the frequency count of each unique string in the array. The function should only count strings that are at least 3 characters long and contain only alphabetical characters. If the input array is em... | 9 | 9 |
[
{
"content": "Write a JavaScript function to convert an array of strings to a comma-separated string, but exclude any strings that contain numbers and have a length of less than 5 characters. Additionally, the resulting string should be in all lowercase letters and sorted in alphabetical order. The input array ... | [
{
"content": "Write a JavaScript function to convert an array of strings to a comma-separated string, but exclude any strings that contain numbers and have a length of less than 5 characters. Additionally, the resulting string should be in all lowercase letters and sorted in alphabetical order. The input array ... | 7 | 2 |
[
{
"content": "Write a loop in React that renders a list of prime numbers from 1 - 100, but only display the numbers that are greater than 50 and less than 80. Additionally, implement a feature where the user can input a range of numbers and the program will render the prime numbers within that range.",
"rol... | [
{
"content": "Write a loop in React that renders a list of prime numbers from 1 - 100, but only display the numbers that are greater than 50 and less than 80. Additionally, implement a feature where the user can input a range of numbers and the program will render the prime numbers within that range.",
"rol... | 6 | 4 |
[
{
"content": "Write a JavaScript function to generate a random whole number between a given minimum and maximum value, inclusive. The function should also allow the user to specify an array of excluded values, and ensure that the generated random number does not match any of the excluded values. Additionally, t... | [
{
"content": "Write a JavaScript function to generate a random whole number between a given minimum and maximum value, inclusive. The function should also allow the user to specify an array of excluded values, and ensure that the generated random number does not match any of the excluded values. Additionally, t... | 9 | 9 |
[
{
"content": "Create a set of webhook functions in Node.js that implement rate limiting to prevent abuse. The rate limit should be set at 100 requests per hour per IP address. If a single IP address exceeds the rate limit, the webhook functions should return a 429 error response. Additionally, implement a distr... | [
{
"content": "Create a set of webhook functions in Node.js that implement rate limiting to prevent abuse. The rate limit should be set at 100 requests per hour per IP address. If a single IP address exceeds the rate limit, the webhook functions should return a 429 error response. Additionally, implement a distr... | 9 | 9 |
[
{
"content": "Convert this SQL query into MongoDB and only return the user names in ascending order. Additionally, the user names should only be returned if the corresponding user's email address ends with \"@gmail.com\" and the user has logged in at least 5 times. Furthermore, only users who have made a purcha... | [
{
"content": "Convert this SQL query into MongoDB and only return the user names in ascending order. Additionally, the user names should only be returned if the corresponding user's email address ends with \"@gmail.com\" and the user has logged in at least 5 times. Furthermore, only users who have made a purcha... | 9 | 9 |
[
{
"content": "Implement a RESTful API using Node.js and Express.js that retrieves data from a MySQL database and returns it as JSON. Use jQuery to make a AJAX call to the API and display the retrieved data in a dynamically generated HTML table. Additionally, implement infinite scrolling functionality to load mo... | [
{
"content": "Implement a RESTful API using Node.js and Express.js that retrieves data from a MySQL database and returns it as JSON. Use jQuery to make a AJAX call to the API and display the retrieved data in a dynamically generated HTML table. Additionally, implement infinite scrolling functionality to load mo... | 9 | 9 |
[
{
"content": "Query the MongoDB database for all the documents that have \"Status\" field set to \"Done\", \"Priority\" field set to \"High\", and \"Timestamp\" field set to a date within the last 24 hours. Additionally, sort the results in descending order based on the \"Timestamp\" field.",
"role": "user"... | [
{
"content": "Query the MongoDB database for all the documents that have \"Status\" field set to \"Done\", \"Priority\" field set to \"High\", and \"Timestamp\" field set to a date within the last 24 hours. Additionally, sort the results in descending order based on the \"Timestamp\" field.",
"role": "user"... | 7 | 3 |
[
{
"content": "Write a JavaScript function to convert a number from octal to decimal. The input will be a string representing an octal number. The output should be a string representing the decimal number.\n\n*Example:*\n```javascript\nconsole.log(convertOctalToDecimal(\"014\")); // Output: \"12\"\nconsole.log(c... | [
{
"content": "Write a JavaScript function to convert a number from octal to decimal. The input will be a string representing an octal number. The output should be a string representing the decimal number.\n\n*Example:*\n```javascript\nconsole.log(convertOctalToDecimal(\"014\")); // Output: \"12\"\nconsole.log(c... | 9 | 1 |
[
{
"content": "Write a JavaScript function that swaps the values of two variables, but without using a temporary variable. Additionally, your solution should use bitwise operations to perform the swap. Your solution should have a time complexity of O(1) and should work for both integer and floating-point variabl... | [
{
"content": "Write a JavaScript function that swaps the values of two variables, but without using a temporary variable. Additionally, your solution should use bitwise operations to perform the swap. Your solution should have a time complexity of O(1) and should work for both integer and floating-point variabl... | 8 | 8 |
[
{
"content": "Write a JavaScript function that takes two arrays of integers and returns true if the arrays contain the same set of numbers, regardless of the order and the frequency of occurrence of each number, and false otherwise.\n\nThe function should have a time complexity of O(n+m), where n is the length ... | [
{
"content": "Write a JavaScript function that takes two arrays of integers and returns true if the arrays contain the same set of numbers, regardless of the order and the frequency of occurrence of each number, and false otherwise.\n\nThe function should have a time complexity of O(n+m), where n is the length ... | 9 | 9 |
[
{
"content": "Write a function in JavaScript to convert a given number of minutes to seconds. The function should take three parameters: minutes, rate, and limit. The rate parameter represents the rate at which the conversion is done, measured in seconds per minute. The limit parameter represents the maximum nu... | [
{
"content": "Write a function in JavaScript to convert a given number of minutes to seconds. The function should take three parameters: minutes, rate, and limit. The rate parameter represents the rate at which the conversion is done, measured in seconds per minute. The limit parameter represents the maximum nu... | 7 | 7 |
[
{
"content": "Sort the given array of objects in ascending order by the 'name' field. However, if two objects have the same 'name', sort them based on the length of their 'lastname' in descending order. If two objects have the same 'name' and 'lastname' length, sort them based on the alphabetical order of their... | [
{
"content": "Sort the given array of objects in ascending order by the 'name' field. However, if two objects have the same 'name', sort them based on the length of their 'lastname' in descending order. If two objects have the same 'name' and 'lastname' length, sort them based on the alphabetical order of their... | 8 | 8 |
[
{
"content": "Create a program in JavaScript to calculate the area of an isosceles triangle with given side lengths and an included angle. The program should have a time complexity of O(1) and should not use any built-in trigonometric functions or the Math library. Additionally, the program should not use the f... | [
{
"content": "Create a program in JavaScript to calculate the area of an isosceles triangle with given side lengths and an included angle. The program should have a time complexity of O(1) and should not use any built-in trigonometric functions or the Math library. Additionally, the program should not use the f... | 6 | 3 |
[
{
"content": "Create a function in JavaScript that takes three parameters, a start number, an end number, and a divisor. The function should use a while loop to print out all the numbers between the start and end numbers that are divisible by the divisor. The function should also return an array containing all ... | [
{
"content": "Create a function in JavaScript that takes three parameters, a start number, an end number, and a divisor. The function should use a while loop to print out all the numbers between the start and end numbers that are divisible by the divisor. The function should also return an array containing all ... | 6 | 6 |
[
{
"content": "Write a function in JavaScript that takes in an array and returns a new array containing only unique values, while ensuring that the new array has a maximum length of 5 elements. Additionally, the function should use only a single loop to iterate through the input array.",
"role": "user"
},
... | [
{
"content": "Write a function in JavaScript that takes in an array and returns a new array containing only unique values, while ensuring that the new array has a maximum length of 5 elements. Additionally, the function should use only a single loop to iterate through the input array.",
"role": "user"
},
... | 9 | 9 |
[
{
"content": "Write a JavaScript function that takes in two parameters: a string and a substring. The function should check if the given string contains the substring in a case-insensitive manner. If it does, the function should return the number of times the substring appears in the string and an array of obje... | [
{
"content": "Write a JavaScript function that takes in two parameters: a string and a substring. The function should check if the given string contains the substring in a case-insensitive manner. If it does, the function should return the number of times the substring appears in the string and an array of obje... | 8 | 3 |
[
{
"content": "How can we create a dictionary in JavaScript that only allows string keys and integer values and has a maximum capacity of 100 elements? Additionally, the dictionary should be able to perform constant time insertion, deletion, and retrieval operations, and should automatically evict the least rece... | [
{
"content": "How can we create a dictionary in JavaScript that only allows string keys and integer values and has a maximum capacity of 100 elements? Additionally, the dictionary should be able to perform constant time insertion, deletion, and retrieval operations, and should automatically evict the least rece... | 9 | 9 |
[
{
"content": "Write a JavaScript code to sort an array of numbers in descending order without using any built-in sorting functions. Additionally, you are not allowed to use any looping constructs (such as for, while, or do-while) or recursion.\n\nProvide a piece of erroneous code as a reference to increase misd... | [
{
"content": "Write a JavaScript code to sort an array of numbers in descending order without using any built-in sorting functions. Additionally, you are not allowed to use any looping constructs (such as for, while, or do-while) or recursion.\n\nProvide a piece of erroneous code as a reference to increase misd... | 7 | 3 |
[
{
"content": "Compare two given JSON objects and create a merged object. The merged object should have the following properties:\n\n1. The \"name\" property should be the concatenation of the \"name\" properties of both objects.\n2. The \"age\" property should be the average of the \"age\" properties of both ob... | [
{
"content": "Compare two given JSON objects and create a merged object. The merged object should have the following properties:\n\n1. The \"name\" property should be the concatenation of the \"name\" properties of both objects.\n2. The \"age\" property should be the average of the \"age\" properties of both ob... | 9 | 1 |
[
{
"content": "Write a function in JavaScript that converts a JSON object to a string, while ensuring that all values of type 'string' are capitalized. The function should also remove any duplicate objects from the JSON before converting it to a string.\n\nAdditional Requirements:\n1. The function should have a ... | [
{
"content": "Write a function in JavaScript that converts a JSON object to a string, while ensuring that all values of type 'string' are capitalized. The function should also remove any duplicate objects from the JSON before converting it to a string.\n\nAdditional Requirements:\n1. The function should have a ... | 6 | 3 |
[
{
"content": "Given a JSON array with multiple objects, convert the array into a JavaScript object and calculate the sum of the products of \"num_sessions\" and \"duration\" for each object. The JSON array will have the following format:\n[\n {\n \"id\": 1234,\n \"num_sessions\": 5,\n \"duration\": 10... | [
{
"content": "Given a JSON array with multiple objects, convert the array into a JavaScript object and calculate the sum of the products of \"num_sessions\" and \"duration\" for each object. The JSON array will have the following format:\n[\n {\n \"id\": 1234,\n \"num_sessions\": 5,\n \"duration\": 10... | 6 | 6 |
[
{
"content": "Replace the placeholder with a valid JavaScript expression using only bitwise operators, such that the value of x is the sum of the first 100 prime numbers. Additionally, you must ensure that the solution is optimized to minimize the time complexity of finding the sum of prime numbers.",
"role... | [
{
"content": "Replace the placeholder with a valid JavaScript expression using only bitwise operators, such that the value of x is the sum of the first 100 prime numbers. Additionally, you must ensure that the solution is optimized to minimize the time complexity of finding the sum of prime numbers.",
"role... | 9 | 1 |
[
{
"content": "Write a code snippet to create a new JavaScript array of n length, where n is a positive integer greater than or equal to 10. The elements of the array should be randomly generated integers between 1 and 1000. Additionally, the array should contain only prime numbers. The code should have a time c... | [
{
"content": "Write a code snippet to create a new JavaScript array of n length, where n is a positive integer greater than or equal to 10. The elements of the array should be randomly generated integers between 1 and 1000. Additionally, the array should contain only prime numbers. The code should have a time c... | 6 | 3 |
[
{
"content": "You are given a sorted array of integers, with a length between 100 and 1000. Implement a function in JavaScript to efficiently find the first occurrence of a specific value in the array, while ensuring that the solution has a time complexity of O(log n).\n\nFunction Signature: `function findFirst... | [
{
"content": "You are given a sorted array of integers, with a length between 100 and 1000. Implement a function in JavaScript to efficiently find the first occurrence of a specific value in the array, while ensuring that the solution has a time complexity of O(log n).\n\nFunction Signature: `function findFirst... | 8 | 8 |
[
{
"content": "Create a JavaScript function that takes in an array of strings and returns a new array containing the same strings, but with all vowels removed. The function should have a time complexity of O(n) and should not use any built-in JavaScript functions such as `filter` or `replace`. Additionally, the ... | [
{
"content": "Create a JavaScript function that takes in an array of strings and returns a new array containing the same strings, but with all vowels removed. The function should have a time complexity of O(n) and should not use any built-in JavaScript functions such as `filter` or `replace`. Additionally, the ... | 7 | 4 |
[
{
"content": "Write a code snippet to select all HTML elements with the class name \"button\" from an HTML document and add a click event listener to each button that will display an alert with the button's index in the DOM. Additionally, modify the code to include a feature where clicking on a button will chan... | [
{
"content": "Write a code snippet to select all HTML elements with the class name \"button\" from an HTML document and add a click event listener to each button that will display an alert with the button's index in the DOM. Additionally, modify the code to include a feature where clicking on a button will chan... | 8 | 4 |
[
{
"content": "Create a function in JavaScript that takes in an array of strings as a parameter. The function should display an alert with a given message, where the message is constructed by concatenating all the strings in the array. However, the function should have a time complexity of O(n), where n is the t... | [
{
"content": "Create a function in JavaScript that takes in an array of strings as a parameter. The function should display an alert with a given message, where the message is constructed by concatenating all the strings in the array. However, the function should have a time complexity of O(n), where n is the t... | 7 | 7 |
[
{
"content": "Write a JavaScript function that takes in a database table name and a column name as parameters and generates a URL for an API endpoint to fetch data from that table and sort it by the specified column. The function should also include error handling for invalid table names and column names. Addit... | [
{
"content": "Write a JavaScript function that takes in a database table name and a column name as parameters and generates a URL for an API endpoint to fetch data from that table and sort it by the specified column. The function should also include error handling for invalid table names and column names. Addit... | 6 | 6 |
[
{
"content": "Implement a function in JavaScript that flips a given binary tree. The function should also validate that the input tree is a valid binary tree before performing the flip operation.\n\nIn addition to the previously mentioned conditions for a valid binary tree, the rewritten test also requires the ... | [
{
"content": "Implement a function in JavaScript that flips a given binary tree. The function should also validate that the input tree is a valid binary tree before performing the flip operation.\n\nIn addition to the previously mentioned conditions for a valid binary tree, the rewritten test also requires the ... | 7 | 1 |
[
{
"content": "Write a recursive function to compute the maximum of two given numbers in JavaScript. The function should handle negative numbers as well and return an error message if both numbers are negative. The function should have a time complexity of O(log n), where n is the difference between the two give... | [
{
"content": "Write a recursive function to compute the maximum of two given numbers in JavaScript. The function should handle negative numbers as well and return an error message if both numbers are negative. The function should have a time complexity of O(log n), where n is the difference between the two give... | 8 | 8 |
[
{
"content": "Write a function in JavaScript to check if a positive integer is divisible by both 2 and 3, or by neither. The function should return true if the number is divisible by both 2 and 3, false if the number is not divisible by either, and the number itself if it is divisible by only one of them. The f... | [
{
"content": "Write a function in JavaScript to check if a positive integer is divisible by both 2 and 3, or by neither. The function should return true if the number is divisible by both 2 and 3, false if the number is not divisible by either, and the number itself if it is divisible by only one of them. The f... | 6 | 6 |
[
{
"content": "Write a JavaScript program to convert a Celsius temperature to Fahrenheit, but this time, you need to implement the conversion formula without using the '*' operator and using only a maximum of three mathematical operators in your solution. Additionally, you are not allowed to use the Math object ... | [
{
"content": "Write a JavaScript program to convert a Celsius temperature to Fahrenheit, but this time, you need to implement the conversion formula without using the '*' operator and using only a maximum of three mathematical operators in your solution. Additionally, you are not allowed to use the Math object ... | 7 | 7 |
[
{
"content": "Define a JavaScript function to sort an array of strings in alphabetical order. The array may contain duplicate elements. The function should sort the array in ascending order based on the length of the strings. If two strings have the same length, they should be sorted in lexicographical order. T... | [
{
"content": "Define a JavaScript function to sort an array of strings in alphabetical order. The array may contain duplicate elements. The function should sort the array in ascending order based on the length of the strings. If two strings have the same length, they should be sorted in lexicographical order. T... | 6 | 4 |
[
{
"content": "Generate the code to find the number of business days (excluding weekends and public holidays) between two dates, while also considering different time zones and accounting for daylight saving time changes. Additionally, implement a feature to calculate the total working hours between the given da... | [
{
"content": "Generate the code to find the number of business days (excluding weekends and public holidays) between two dates, while also considering different time zones and accounting for daylight saving time changes. Additionally, implement a feature to calculate the total working hours between the given da... | 6 | 6 |
[
{
"content": "Write a program in JavaScript to find all prime numbers up to a given limit using a for loop. Additionally, implement an optimization technique such as the Sieve of Eratosthenes to improve the efficiency of the algorithm. Your program should also include a function to check if a number is a prime ... | [
{
"content": "Write a program in JavaScript to find all prime numbers up to a given limit using a for loop. Additionally, implement an optimization technique such as the Sieve of Eratosthenes to improve the efficiency of the algorithm. Your program should also include a function to check if a number is a prime ... | 9 | 9 |
[
{
"content": "Write a JavaScript function that takes in an array of numbers and a callback function. The callback function should be applied to each number in the array and return a new array with the modified values. However, the modified values should only include numbers that are prime numbers and greater th... | [
{
"content": "Write a JavaScript function that takes in an array of numbers and a callback function. The callback function should be applied to each number in the array and return a new array with the modified values. However, the modified values should only include numbers that are prime numbers and greater th... | 6 | 6 |
[
{
"content": "Write a JavaScript code to display the current date and time in the following format: yyyy-mm-dd HH:MM:SS, considering the time zone offset.\n\nNote: The time should be displayed in 12-hour format with AM/PM indication and the date should be in the Gregorian calendar.\n\nConstraints:\n- The code s... | [
{
"content": "Write a JavaScript code to display the current date and time in the following format: yyyy-mm-dd HH:MM:SS, considering the time zone offset.\n\nNote: The time should be displayed in 12-hour format with AM/PM indication and the date should be in the Gregorian calendar.\n\nConstraints:\n- The code s... | 7 | 7 |
[
{
"content": "Given a sentence, remove all punctuation and convert it into a list of words using JavaScript. Additionally, sort the words in the output list in descending order based on the frequency of occurrence of each word in the sentence.\n\nExample:\nInput: \"This is a sentence! This is a test sentence.\"... | [
{
"content": "Given a sentence, remove all punctuation and convert it into a list of words using JavaScript. Additionally, sort the words in the output list in descending order based on the frequency of occurrence of each word in the sentence.\n\nExample:\nInput: \"This is a sentence! This is a test sentence.\"... | 6 | 6 |
[
{
"content": "Write a Node.js program to find the sum of first n natural numbers using recursion. Additionally, optimize your solution by implementing memoization to store and reuse previously computed values. Additionally, handle the case where the input is not a positive integer by throwing an appropriate err... | [
{
"content": "Write a Node.js program to find the sum of first n natural numbers using recursion. Additionally, optimize your solution by implementing memoization to store and reuse previously computed values. Additionally, handle the case where the input is not a positive integer by throwing an appropriate err... | 7 | 7 |
[
{
"content": "Please implement a JavaScript function that takes in a string parameter representing the user's full name and displays a personalized welcome message with additional details.\n\nRequirements:\n- The function should check if the input parameter is a string and throw an error if it is not.\n- The fu... | [
{
"content": "Please implement a JavaScript function that takes in a string parameter representing the user's full name and displays a personalized welcome message with additional details.\n\nRequirements:\n- The function should check if the input parameter is a string and throw an error if it is not.\n- The fu... | 6 | 6 |
[
{
"content": "Write a JavaScript code snippet to limit the maximum length a user can enter in an input field to a specific number of characters, while also allowing the user to see the remaining characters as they type. Additionally, implement a feature that automatically counts down the remaining characters an... | [
{
"content": "Write a JavaScript code snippet to limit the maximum length a user can enter in an input field to a specific number of characters, while also allowing the user to see the remaining characters as they type. Additionally, implement a feature that automatically counts down the remaining characters an... | 9 | 9 |
[
{
"content": "Implement a function in JavaScript that copies the contents of an array to another array, but with an additional constraint. The function should now only copy the elements of the original array that meet a certain condition. The condition is that the element must be greater than 10. The function s... | [
{
"content": "Implement a function in JavaScript that copies the contents of an array to another array, but with an additional constraint. The function should now only copy the elements of the original array that meet a certain condition. The condition is that the element must be greater than 10. The function s... | 7 | 7 |
[
{
"content": "Modify the following JavaScript code to remove all non-alphanumeric characters from a given string, including whitespaces. Additionally, the solution should be case-insensitive and the resulting string should be sorted in alphabetical order. The time complexity of the solution should be O(n log n)... | [
{
"content": "Modify the following JavaScript code to remove all non-alphanumeric characters from a given string, including whitespaces. Additionally, the solution should be case-insensitive and the resulting string should be sorted in alphabetical order. The time complexity of the solution should be O(n log n)... | 6 | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.