instruction_seed stringlengths 0 26.4k | source stringclasses 4
values |
|---|---|
Design a neural network architecture in TensorFlow to predict the sentiment of a movie review. Implement a custom loss function that penalizes misclassifying positive reviews as negative more heavily than misclassifying negative reviews as positive. Additionally, optimize the neural network using batch normalization an... | codefeedback |
Write a Java program to compare two strings and determine if they are equal. The program should also check if the two strings are anagrams of each other. Additionally, the program should calculate the Damerau-Levenshtein distance between the two strings, which is the minimum number of single-character edits (insertions... | codefeedback |
What is the purpose of a user interface (UI) in the context of a virtual reality (VR) application? Provide a detailed explanation, considering the specific challenges and design considerations associated with developing UI for VR experiences. | codefeedback |
Query a MongoDB to get all documents with a certain field value, but only return the documents that have a specific nested field value within an array. Additionally, implement error handling to gracefully handle any connection issues or invalid queries. | codefeedback |
Write a program that converts a given number to its English word equivalent. The input number can be any positive integer up to 1 billion. The program should handle both singular and plural forms of the English words (e.g. "1 apple" vs "2 apples").
Additionally, your program should include error handling to handle inv... | codefeedback |
Write a python function to detect if two lists contain the same items in different order. Your solution should have a time complexity of O(n log n), where n is the length of the lists. The function should also handle cases where the lists contain nested lists or dictionaries, and should return True if the nested elemen... | codefeedback |
Write a Python function called "concatenate_lists" that takes in two lists, "list1" and "list2", as parameters. The function should concatenate the elements of "list1" and "list2" into a new list and return the result.
The function should also handle cases where "list1" or "list2" are empty, returning an appropriate ... | codefeedback |
Write a SQL query to get the products that have been purchased in the last month and have a price greater than $100, ordered by the total number of purchases for each product. | codefeedback |
Create a database table using SQL to store user preferences. The table should include columns for user ID, preference name, preference value, and timestamp. Additionally, the preference value should be limited to a maximum length of 255 characters. Implement a trigger that will automatically update the timestamp column... | codefeedback |
Given a string, print all the words in the string that are longer than 5 characters and contain at least one uppercase letter.
For example, if the input string is "This is a Test string for a coding Challenge", the expected output would be "Challenge".
To solve this problem, we can follow these steps:
1. Initializ... | codefeedback |
Create a program that takes a string as input and prints out each word in reverse order. The program should also ignore any leading or trailing whitespace in the input string. Additionally, the program should handle cases where the input string contains punctuation marks and special characters.
Example Input: " Hell... | codefeedback |
Explain what is hyperparameter tuning in the context of a machine learning algorithm and provide a specific example of hyperparameter tuning for a neural network using the Adam optimizer, the learning rate decay technique, and batch normalization. Additionally, explain the impact of each hyperparameter on the model's p... | codefeedback |
Create a Go program to read a list of integer values from the command line, calculate the sum of their squares, and then calculate the square root of the result. The program should also output the largest and smallest numbers in the list. | codefeedback |
Given a sentence, count the number of sub strings of length 3 that are present in the sentence. Each sub string should start with a vowel and end with a consonant. Additionally, the sub strings should not overlap with each other.
To solve this problem, follow these steps:
1. Initialize a counter variable to keep trac... | codefeedback |
Create a function to determine if a given string is a palindrome, but you are not allowed to use any built-in string manipulation functions or methods. | codefeedback |
Create a program to find the maximum difference between two prime numbers in an array of positive integers. The array will always contain at least two prime numbers. Additionally, the program should also identify the two prime numbers that yield the maximum difference. | codefeedback |
Write a method to calculate the average of an array of n numbers in Python. The array can contain both positive and negative integers, but the average should only consider the positive integers. The method should have a time complexity of O(n) and a space complexity of O(1). | codefeedback |
Write a web application in HTML and JavaScript to view a list of books. The application should fetch the list of books from an API endpoint and display them dynamically on the webpage. Each book should have a title, author, and a cover image. Additionally, the application should allow the user to search for books by ti... | codefeedback |
Given a list of integers, output the second largest distinct number. If there is no second largest distinct number, output -1.
Example:
Input: [9, 4, 57, 28, 24, 10]
Output: 28
Input: [9, 4, 4, 4, 4, 10]
Output: 9
Input: [1, 1, 1, 1, 1]
Output: -1
Input: [3, 6, 2, 9, 7]
Output: 7
Input: []
Output: -1
Input: [1]
O... | codefeedback |
Write a code segment that manipulates a Fibonacci sequence until the sum is greater than a given number and also only includes even numbers in the sequence. Additionally, the code should compute and print the average of the even numbers in the sequence. | codefeedback |
Create a shell script that prints out the day of the week based on the current day, but exclude weekends (Saturday and Sunday). Additionally, the script should exclude any public holidays listed in a separate text file called "holidays.txt". The script should check the current date against the list of holidays and week... | codefeedback |
Separate the given array of numbers into four new arrays, where one array contains prime numbers, one array contains even numbers, one array contains odd numbers, and one array contains numbers divisible by 3. The prime numbers should be sorted in descending order, while the even numbers, odd numbers, and numbers divis... | codefeedback |
Design a SQL query to get the salary, department, and employee name of the employee who has the maximum salary in each department, while also ensuring that the employee has worked for at least 5 years in the company. Additionally, sort the result by department name in ascending order. | codefeedback |
Code a function in R which concatenates two strings of a given length and returns the resulting string. However, you are not allowed to use the built-in concatenation operator or any other built-in functions that directly concatenate strings. You need to implement your own concatenation algorithm. Additionally, your im... | codefeedback |
Design a Python program to print all numbers between 0 and 100 that are divisible by 3 and 5, and are also prime numbers. Additionally, the program should display the sum of all the prime numbers found. | codefeedback |
Create a function to calculate the exponent of a given number x raised to power y. The function should have a time complexity of O(log y) and a space complexity of O(1). Additionally, you are not allowed to use any built-in exponentiation functions or operators (such as `**` or `Math.pow`). | codefeedback |
Write a query in MySQL to find the most popular item in a store, considering only items that have been purchased at least 10 times within the last week and have a rating of 4 or higher. Additionally, exclude any items that have been purchased by the same customer more than once. | codefeedback |
Devise a function that converts a number represented in the binary system to a decimal number. However, the function should not use any built-in functions or libraries that directly convert binary to decimal, and it should also not use any loops or recursion. | codefeedback |
Given two Unix timestamps, find the difference between them in minutes, rounded down to the nearest whole number. The time complexity should be O(1). | codefeedback |
Rewrite this code in a more efficient way making use of the built-in sort functions. Additionally, handle the case when the input list is empty. The input list will now contain both integers and strings. Sort the list in ascending order based on the numeric values of the integers, and in alphabetical order for the stri... | codefeedback |
You are given a database table that contains information about various countries. Each record in the table has the following fields: country name, population, and GDP. Write a code that takes a country name as input and selects the records from the table where the country name is identical to the input. From the select... | codefeedback |
Create an HTML form with three text fields: one for the user to enter their email address, another for them to enter their password, and a third for them to confirm their password. The form should also include a submit button.
When the user clicks the submit button, validate that the email address entered is in a val... | codefeedback |
Design a program that prints out the multiplication table up to n x m, where n and m are user-inputted positive integers.
The program should prompt the user to enter the values of n and m. It should then validate the input to ensure that n and m are positive integers.
Once the input is validated, the program should ... | codefeedback |
Write a MySQL query to count the number of students enrolled in a course called "Coding 101" and whose age is between 18 and 25, and whose GPA is above 3.5. | codefeedback |
Implement an algorithm to find the power of a number.
Base: 2, Exponent: 1000000
Additional Instructions:
1. The algorithm should be able to handle large exponents efficiently, such as exponents in the range of 10^9 or higher.
2. The algorithm should not use any built-in functions or libraries for exponentiation.
3. T... | codefeedback |
Create an HTML form with one text field and one submit button. When the user submits the form, validate the input in the text field to ensure it is a valid email address. Additionally, implement client-side validation to check if the email address already exists in the database. If the email address already exists, dis... | codefeedback |
How do you create a new dataframe by merging two pandas dataframes based on multiple specific columns, while also specifying different merge methods for each column? | codefeedback |
Create a list of the top 5 programming languages currently in use, excluding any languages that were released before 2010. Additionally, rank the programming languages based on the following criteria:
1. Number of job listings on popular job portals.
2. Popularity on coding forums and communities.
3. Number of active o... | codefeedback |
Generate an SQL query to calculate the average age of all employees from the table 'employees'. In addition, also display the number of employees whose age is above the average age. Additionally, sort the result in descending order of the number of employees above the average age. | codefeedback |
Create a table using JavaScript with four columns, "Name", "Age", "Country", and "Gender". Additionally, add functionality to allow the user to add new rows to the table dynamically. Implement data validation to ensure that the user cannot add duplicate rows based on the combination of "Name", "Age", "Country", and "Ge... | codefeedback |
Generate a correct C++ code to delete the second occurrence of a given value from an array, but without using any built-in functions or libraries.
Delete the second occurrence of the value 5 from the array [5, 3, 5, 10, 8], and ensure the deletion is done in-place without creating a new array. The time complexity of yo... | codefeedback |
Create an Angular component that displays a customized welcome message based on the user's location. The component should fetch the user's geolocation using the browser's API and determine their city. The message should be displayed in the user's native language and include a flag icon of their country. Additionally, t... | codefeedback |
How do you securely connect to a PostgreSQL database using Java and ensure data integrity during transmission? Implement a method that also checks for database access privileges before establishing the connection. | codefeedback |
Given a 2D array of integers, write a Java method to find the maximum sum of all possible hourglass patterns. An hourglass pattern is defined as a subset of the array that consists of 7 elements shaped like an hourglass:
a b c
d
e f g
For example, in the following array:
[[1, 1, 1, 0, 0, 0],
[0, 1, 0,... | codefeedback |
Create a 3-dimensional array of ints in C# that contains only prime numbers and has a length of 100 in each dimension. | codefeedback |
Design a recursive function to calculate the sum of the squares of the numbers between 1 and n, while also keeping track of the number of function calls made during the calculation. The function should handle negative input values of n by converting them to positive values before calculating the sum.
The function shou... | codefeedback |
Given two linked lists, write a Java program to merge them in ascending order while maintaining the original order of elements within each linked list. The merged linked list should not contain any duplicate values. Additionally, you should optimize your program to have a time complexity of O(n log n), where n is the t... | codefeedback |
Generate a SQL query to find all the table names in a specific schema within a database, excluding any tables that have a specific column with a specific value. The query should also order the table names alphabetically. | codefeedback |
Design a SQL query to find the first name of all employees of a company who have been with the company for more than 5 years and have received a salary increase of at least 10% in the last year.
Table "Employee" with columns: FirstName, LastName, Email, CompanyID, JoinDate, Salary, LastSalaryIncreaseDate | codefeedback |
Create a program to convert kilometers to miles in C++. However, you need to implement the conversion formula manually without using any built-in functions or libraries. Convert 10 kilometers to miles, but also add functionality to convert miles to kilometers.
Furthermore, enhance the program by allowing the user to c... | codefeedback |
Create a script to clone a GitHub repository using only the command line interface. The repository name is "myproject" and it is hosted under a specific organization named "myorganization". Additionally, the script should prompt the user to enter their GitHub username and password before cloning the repository, ensurin... | codefeedback |
Design an algorithm to swap the values of two variables in Python without using a third variable. The variables A and B are of different data types - A is an integer and B is a list of strings. | codefeedback |
Write a Java program that calculates the average of 10 numbers. The numbers are stored in an array of size 10, which is filled with random integers between 1 and 1000 (inclusive).
In addition to calculating the average, your program should also find the minimum and maximum values in the array. Print these values along... | codefeedback |
Create a SQL statement to list all the entries with a rating greater than 3 and a release date within the last year from the table "movies". Additionally, order the results in descending order based on the movie's duration. | codefeedback |
Create an SQL statement to select the title, description, and release date of all movies with a rating greater than 3, that were released after 2010, have a duration longer than 2 hours, and have the genre "Action". | codefeedback |
Write a C++ program to calculate the sum of all the elements in a given array, but you are not allowed to use any loops, recursion, or any standard library functions for arithmetic operations such as addition or multiplication in your solution. | codefeedback |
Write a JavaScript function to check whether a string is a palindrome. The function should ignore any non-alphanumeric characters and should be case-insensitive. Additionally, the function should be implemented using a recursive approach. | codefeedback |
Write an SQL query to join three tables named 'books', 'authors', and 'publishers' on author_id and publisher_id respectively. Include an additional condition in the join such that only books with a publication year after 2010 are included in the result. | codefeedback |
What is the unary operator used to increment a variable by 3 in C++ and what is its time complexity? | codefeedback |
Rewrite the code below using Java and add the following additional requirements:
1. Convert the list items to uppercase before printing.
2. Only print the items that are strings.
3. Print each item along with its index position in the list.
4. Sort the list in descending order based on the length of the string items.
5... | codefeedback |
Suggest a code snippet in Python to delete the dictionary entry with a key called "name". Additionally, ensure that the code snippet also raises an exception if the key "name" does not exist in the dictionary, and prints a custom error message indicating that the key does not exist.
Furthermore, modify the code to ha... | codefeedback |
Implement a recursive function to calculate the factorial of a positive integer, while also keeping track of the number of function calls made. The function should have a time complexity of O(n) and should not use any loops or iteration. Additionally, the implementation should handle edge cases such as large input valu... | codefeedback |
Please write a program that simulates a simple online banking system.
1. Create a class called "BankAccount" that has the following attributes:
- Account number (a randomly generated alphanumeric string of length 10)
- Account holder name
- Balance (initially set to 0)
2. Implement the following methods in t... | codefeedback |
Write a function in JavaScript to capitalize all the words in a given phrase, while also ensuring that any word that starts with a vowel is capitalized and any word that starts with a consonant is capitalized only if it is the first word in the phrase. The function should also remove any punctuation marks at the end of... | codefeedback |
Implement an iterative binary search algorithm that searches for a target element in a sorted array. The algorithm should have a time complexity of O(log n) and a space complexity of O(1), where n is the size of the array.
#Justification for Increase in Difficulty#
The original test required the implementation of a re... | codefeedback |
Create a function in PHP that reverses the order of an array without using the built-in array_reverse function. The function should not use any additional arrays or variables to store intermediate values. The input array should only contain integers. The function should handle arrays of any length, up to a maximum of 1... | codefeedback |
Create a function that returns the maximum element of a given list, without using any built-in functions. The function should also handle the case where the list may contain duplicate elements. The input list will always contain at least two elements and the maximum element will always be unique. Given List: [3, 12, 2,... | codefeedback |
Write a Python decorator that takes a function as an argument and returns a modified function that only executes if the current date is a prime number. The modified function should also print out the total number of prime numbers found so far.
Additionally, the modified function should only execute if the current date... | codefeedback |
Create an HTML code to produce a form which contains two text fields (username and password) and submit button. Additionally, include client-side validation to ensure that the username field contains at least 6 characters and the password field contains at least 8 characters. Display an error message if these condition... | codefeedback |
Construct a class in Java that has two methods called 'sayHello' and 'sayGoodbye'. The 'sayHello' method should take in a String parameter and print out "Hello, {parameter}!" The 'sayGoodbye' method should take in an integer parameter and print out "Goodbye, {parameter}!". Additionally, the class should keep track of t... | codefeedback |
Debug a logic error in this JavaScript code that returns the wrong result and improve the efficiency of the function.
Write a function `multiply` that takes two parameters `a` and `b` and returns the product of the two numbers. The function should not use the `*` operator.
Example:
```
multiply(5, 4) ➞ 20
multiply(0,... | codefeedback |
Create a JavaScript code to insert a given item at the specified position in an array. The specified position is a negative index. If the negative index is greater than the length of the array, the item should be inserted at the end of the array. If the negative index is less than or equal to the negative of the length... | codefeedback |
Create a function in Java to convert a string of comma-separated values into an array, but the array should only include values that are all lowercase letters. If the string contains any values that are not all lowercase letters, those values should be ignored and not included in the array.
data = "Banana, apple, Apri... | codefeedback |
Develop a code to sort a list in ascending or descending order. The code should also handle cases where the given list contains duplicate elements and should remove any duplicate elements while sorting. The output should be the sorted list without any duplicate elements. The code should have a time complexity of O(nlog... | codefeedback |
Write a JavaScript function that takes in an array of integers and returns a new array with all even numbers removed. Additionally, the function should only use a single loop and should have a time complexity of O(n), where n is the length of the input array. However, the function should now be implemented without usin... | codefeedback |
Write a code to create a dictionary containing the frequency of each word in a given string, considering that the words are case-sensitive. Additionally, you should exclude any words that contain numbers or special characters from the dictionary.
For example, for the input string S = "Hello hello world!123", the expect... | codefeedback |
Design a code to search a given element x in a vector with a time complexity of O(log n), where n is the number of elements in the vector. The vector is sorted in ascending order.
Please provide a piece of erroneous code as a reference to increase misdirection. | codefeedback |
Create a Java program to implement a doubly linked list with the following operations: insert, delete, display, reverse, and find. The find operation should search for a specific element in the linked list and return its index. The program should also include a function to check if the linked list is circular. The inse... | codefeedback |
Construct a program which takes two numbers as input and returns the multiplication of these numbers. However, the program should only use bitwise operators to perform the multiplication. You are not allowed to use the multiplication operator or any other arithmetic operators.
Example input: 10, 5
Expected output: 50
... | codefeedback |
Generate an HTML page using the defined header and footer, but the footer should only be displayed if the current year is a prime number and the number of vowels in the header is odd. | codefeedback |
Rewrite the following code to output the result in the command line using Node.js, but also add a piece of erroneous code to mislead the developer.
```javascript
let sum = 10 + 20;
console.log("The result is: " + sum);
console.log("The result is: " + sum * 2);
```
#Rewritten Test (Increased Difficulty)#
Rewrite the ... | codefeedback |
Please correct the following code in Java.
Requirements:
1. The code must have a class named "HelloWorld".
2. The class must have a public static method named "main" that takes an array of strings as a parameter and returns nothing.
3. The main method must print "Hello World!" to the console.
4. The code must not use ... | codefeedback |
Given a 2-dimensional array of size n x m, where n is the number of rows and m is the number of columns, create a code to transpose the array.
A transpose of a matrix is obtained by flipping the matrix over its main diagonal, switching the row and column indices of each element.
Your code should have a time complexit... | codefeedback |
Create a C++ program to concatenate two string variables. The concatenated string must have the following requirements:
- The length of the concatenated string must not exceed 50 characters.
- The program must ignore any leading or trailing whitespace characters in both input strings before concatenating them.
- If the... | codefeedback |
Given a sentence, write a JavaScript program to find out whether the sentence contains all the vowels. Additionally, the program should check for the presence of each vowel multiple times and ensure that they appear in alphabetical order. The sentence should not exceed 100 characters and must be case-sensitive. | codefeedback |
Generate a random letter between a and z, but exclude the letters e and q from the possible options. After generating the letter, check if it is a vowel. If it is a vowel, generate another letter until a consonant is generated. Finally, check if the generated letter is uppercase or lowercase and print it accordingly. | codefeedback |
Write the SQL query to print out all the products in the product table, sorted in descending order of their prices, where the prices are greater than 100 and the product names contain the word "electronics". | codefeedback |
Write a method to find all duplicate elements in an array of integers, where each element is in the range from -10^9 to 10^9, and return them in ascending order.
Additional requirements:
1. Your method should have a time complexity of O(n).
2. Your method should use constant space, i.e., it should not create any addit... | codefeedback |
Write a boolean expression for the statement "The absolute value of x is greater than y" using only bitwise operators and without using any comparison operators. The time complexity of the solution should be less than O(n), where n is the number of bits required to represent the maximum value of x. | codefeedback |
Create a React component called "EmployeeInfo" that displays the following information about an employee: Name, Age, and Department. The component should also include an input field where the user can enter the employee's salary, a button that allows the user to submit the salary, and a dropdown menu where the user can... | codefeedback |
Using Java, write a program to find the sum of prime numbers from 1 to an input number. The input number will always be greater than 1. The program should also identify and display the largest prime number within the given range. Additionally, the program should handle input validation to ensure that the input number i... | codefeedback |
Write a code to create a function to rotate a given linked list by a given number of positions.
You are given a singly linked list and an integer k, where k represents the number of positions to rotate the linked list. A rotation means moving the elements of the linked list k positions to the right.
Implement a funct... | codefeedback |
Generate a Ruby program which returns the sum of all even Fibonacci numbers between 0 and 1,000,000. Additionally, the program should calculate the sum using a recursive function. | codefeedback |
Create a web application that allows users to input and store information about people, including their name, age, nationality, and occupation. The application should display this information in a table, with the nationality displayed as a flag icon next to each person's name. Users should be able to sort the table by ... | codefeedback |
Create a class in Java that encapsulates a student's name, grade point average (GPA), and a list of courses they have taken.
The class should have the following methods:
1. `addCourse(String courseName, int creditHours, double grade)` - adds a course to the student's list of courses, where `courseName` is the name of ... | codefeedback |
Write a CSS code to create a div container with the following specifications:
- Width of 500px
- Height of 300px
- Background color of #000000
- Font color of #FFFFFF
- Font size of 20px
- Padding of 20px
- Margin of 10px
- Border radius of 10px
- Box shadow with a horizontal offset of 5px, a vertical offset of 5px, a ... | codefeedback |
Compress the following string using LZW compression algorithm, ensuring that the compressed output contains a maximum of 5 consecutive repeating characters in any cluster.
Input: ‘ABBBBCCDDEEEFFFFGGGGGHHHHH’
(Note: The input string contains repeating characters in larger clusters and the compressed output should have... | codefeedback |
Create a SQL query to select users born on a leap year before 1989-02-17 and have a salary greater than $50,000. | codefeedback |
Implement a secure FTP server in Python that supports both active and passive mode.
The server should have the following features:
1. Support for multiple simultaneous connections with a maximum of 100 connections at a time.
2. User authentication using username and password with the option for two-factor authenticati... | codefeedback |
Given a JavaScript code, what are valid identifier names for its variables and functions? Additionally, for each valid identifier name, determine its corresponding data type (e.g., string, number, boolean, object, array, function, etc.).
The solution should not rely on any external libraries or packages.
Additional ... | codefeedback |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.