instruction_seed stringlengths 0 26.4k | source stringclasses 4
values |
|---|---|
Identify the differences between Java and JavaScript languages, focusing specifically on the object-oriented features and inheritance mechanisms in each language. | codefeedback |
Design a convolutional neural network for facial recognition using TensorFlow. Include at least 5 convolutional layers with different filter sizes, and implement batch normalization after each convolutional layer. Additionally, incorporate dropout regularization with a rate of 0.5 after each fully connected layer. Expe... | codefeedback |
Create a Python script to parse a JSON string and print the value corresponding to the key 'name'. The JSON string may contain nested objects and arrays. Your script should be able to handle parsing and printing the value of 'name' from any valid JSON string.
Example input 1:
{"name": "John Doe", "age": 25}
Expected ... | codefeedback |
Write a code to recognize the most likely programming language of a given code snippet based on its syntax and keywords. | codefeedback |
Generate a code snippet to clone/copy a nested dictionary, preserving the original structure and values. | codefeedback |
Formulate a solution to print out each letter of a string individually, but without using any built-in string manipulation functions or loops. The solution should have a time complexity of O(n) and a space complexity of O(1). | codefeedback |
Create a program to generate a sequence of integers that starts at k and ends at n in the following format: [k, k^2, k^3, ..., n^2, n^3].
#Difficulty Increase#
In the rewritten test, the sequence is generated by raising each integer to the power of 2 or 3. This requires additional computation for each element in the s... | codefeedback |
Write a function that takes two arrays and returns a new array with all the items of the first array followed by all the items of the second array, while ensuring that the resulting array is sorted in ascending order.
array1 = [1, 4, 3]
array2 = [2, 5, 6]
Constraints:
- The input arrays can contain duplicates.
- The... | codefeedback |
Suggest a solution to print the prime factorization of a number and optimize it for large numbers.
Additional Requirements:
1. Implement a function called "prime_factorization" that takes an integer as input and returns a list of its prime factors.
2. The function should handle large numbers efficiently (e.g., up to 1... | codefeedback |
Create a program to reverse an array in place, but with the constraint that the program should use only constant extra space (O(1)) and have a time complexity of O(n), where n is the length of the array. | codefeedback |
Write a web scraper in Python to get all the external links from a webpage, while adhering to the following constraints:
- The scraper should not use any external libraries or modules.
- The scraper should handle pagination and be able to scrape multiple pages, following the links found on each page.
- The scraper shou... | codefeedback |
Write a code to update the elements of a list inplace. The elements of the list are in the range of 0 to 100,000. The list can have up to 1,000,000 elements.
lst = [2, 4, 6, 8, ..., 100000] | codefeedback |
Generate a correct Ruby program to print all possible combinations of a given list, where the length of the list is n (1 ≤ n ≤ 10) and each element in the list is a string of lowercase letters (1 ≤ length of string ≤ 5). The program should not use any built-in functions or libraries that directly generate combinations.... | codefeedback |
Using the function above, complete the following statement to compute the sum of all prime numbers from 2 to 6. | codefeedback |
Write a code to fetch the title of a web page and print it in reverse order. | codefeedback |
Find the value of $x^3 + 4x^2 + 5x + 6$ when $x = 3$ | codefeedback |
Describe the tasks and input of a program to sort a list of integers in ascending order, using only constant space and without using any built-in sorting functions. The program should handle duplicate integers in the input list and should also return the number of swaps performed during the sorting process. | codefeedback |
Write a JavaScript code to rotate an array by n positions to the left. The array should be rotated in place, meaning no additional arrays or data structures should be used.
Example:
arr = [1, 2, 3, 4, 5]
pos = 2
After rotating the array by 2 positions to the left, the new array should be [3, 4, 5, 1, 2].
You are n... | codefeedback |
Create a list of integers from 1 to n, where n is a user-defined positive integer, in steps of 10.
The program should prompt the user to enter a positive integer value for n. If the user enters an invalid input (e.g., a negative number or a non-integer), the program should display an error message and prompt the user... | codefeedback |
Write a JavaScript program to find the maximum number from the given three numbers, but with the additional requirement that the solution must be implemented using recursion. The numbers to be compared are 5, 10, and 3. | codefeedback |
Read an HTML page and extract all the <h2> tags and their corresponding text content. The HTML page may also contain nested <h2> tags.
Example input:
<html>
<h1>Heading 1</h1>
<h2>Subheading 1</h2>
<p>Paragraph 1</p>
<h2>Subheading 2</h2>
<p>Paragraph 2</p>
<h3>Sub-subheading 1</h3>
<p>Paragraph 3</p>
... | codefeedback |
Write a function in Java to calculate the total number of possible combinations of a given list of items, where each item can only be used once in each combination. The function should have a time complexity of O(n!), where n is the length of the input list. | codefeedback |
Retrieve the elements from the second index to the fourth index, inclusive, in the given array, ensuring that the sum of all the retrieved elements is greater than or equal to 100.
Array: [10, 20, 50, 70, 90, 100] | codefeedback |
Generate a matrix with 1000 rows and 1000 columns containing random numbers in it. | codefeedback |
Write a LINQ query to find employees whose age is over 30 and are from the United States. The query should also exclude any employees whose job title is "Manager" and have an annual salary over $100,000. | codefeedback |
Construct a switch statement to return either "Nick" or "Jack" base on the value of the input. The input must be a non-empty string containing only lowercase letters. The output must be a string enclosed in double quotes. The switch statement must have at least three cases. The program should handle both uppercase and ... | codefeedback |
Design a program that takes a list of numbers as input and prints the numbers in ascending order, without using any built-in sorting functions or methods. The program should have a time complexity of O(n^2), where n is the number of elements in the list. | codefeedback |
Slice the following array to get the last two odd numbers.
[2, 3, 9, 12, 13, 21] | codefeedback |
Write a query to retrieve all the customers whose customer ID starts with a "C" and whose orders contain at least two products with a price greater than $100 each. | codefeedback |
Given a string s, write a Python function that returns the length of the longest palindromic substring within the given string.
Example:
s = "abcbabcd"
Output: 4
In this example, the longest palindromic substring is "abcd", which has a length of 4. | codefeedback |
Create a chatbot using Python that can hold multiple conversations simultaneously with different users. Each conversation should maintain its own state and respond intelligently to user inputs. The chatbot should be able to handle complex queries and provide relevant and accurate responses. Additionally, implement a na... | codefeedback |
Implement a function to check for balanced parentheses in a given string.
String: (((())()))
Additional condition: The string may also contain other characters apart from parentheses.
#Solution# | codefeedback |
Convert the following range to list elements in Python, ensuring that the resulting list only contains odd numbers and is sorted in descending order. | codefeedback |
Write an SQL query to find the name of all customers who have made orders before the given date and have made more than 5 orders in total. The output should also include the total number of orders made by each customer.
Table: Customers
Fields: name, order_date, order_count
Given_date = 17/2/2020 | codefeedback |
Given a string s, reverse the characters in each word of the string and return the resulting string.
s = "apple banana" | codefeedback |
Generate a list of distinct dates between two given dates using JavaScript, excluding weekends and holidays.
startdate = "01/20/2020"
enddate = "05/17/2020"
Note: You can assume a predefined list of holidays is provided. | codefeedback |
Write a Python script to check for syntactic correctness of an algorithm, ensuring that each step is properly indented and ends with a colon. The algorithm must also contain at least one loop or conditional statement. | codefeedback |
Write a function that takes a string and returns the letter which appears most frequently. The input string will only contain lowercase letters and will have a length of at most 100 characters.
Example:
Input: "apple"
Output: "p" | codefeedback |
Codify a static HTML page such that when the page URL is accessed, it displays the message "Please enter your login details". Additionally, add a form with two input fields for username and password, and a submit button. Upon submitting the form, validate the entered credentials and display an appropriate message such ... | codefeedback |
Design a Java code to create a method that counts the number of odd elements in a given array. The method should return the count of odd elements in the array.
int[] array = {2, 4, 6, 8} | codefeedback |
How to find the most common integer in a list while considering only positive integers and excluding any duplicates? | codefeedback |
Given a JSON object with nested arrays and objects, code a JavaScript function to convert the object into a query string. The function should only include key-value pairs that have non-null values and exclude any key-value pairs that have empty arrays or objects. Additionally, the function should sort the key-value pai... | codefeedback |
Create a dictionary containing the frequencies for each character in the given string, but only include characters that are not vowels.
string = "hello world" | codefeedback |
You are given a string array. Code a JavaScript function to remove duplicate strings from the array. The function should also sort the strings in descending order based on their length. If two strings have the same length, their order should be determined by their lexicographic order. Let arrStrings = ["apple", "orange... | codefeedback |
Code an assembly language program to calculate the sum of series 1 + 4 + 7 +.....+ (3*n-2).
n = 10 | codefeedback |
Given an array of numbers, code a Java program to find the highest number. The program should also handle the case when the array is empty and return an appropriate message. Additionally, the program should keep track of the number of times the highest number appears in the array and print this count along with the hig... | codefeedback |
Implement a Java program to demonstrate the use of abstract classes and interfaces in a real-world scenario. Consider the following requirements:
1. Create an abstract class named "Shape" with the following attributes and methods:
- Attributes: color (string), filled (boolean)
- Methods: getColor(), setColor(), ... | codefeedback |
You are given some HTML code, write a function to strip the tags from it. Additionally, make sure that the function handles nested tags correctly. | codefeedback |
Write a program that implements a hash table data structure from scratch using only arrays and basic operations such as insert, delete, and search. The hash function should be a custom implementation and should have a time complexity of O(1) in the average case. | codefeedback |
Create a system call in C to generate a process tree, where each process has a unique randomly generated priority value between 1 and 10. The parent process should always have a higher priority than its child processes. The process tree should be constructed in a way that each child process has a maximum of 3 child pro... | codefeedback |
Create a data structure to store an employee's details including his personal details, such as name, address, and contact information, as well as his salary information including basic salary, bonus, and deductions. Additionally, design a method to calculate the net salary after considering various tax brackets based o... | codefeedback |
Create a program to list all the prime numbers between two numbers, but the program should also display a warning message if either of the input numbers is negative or if the first number is greater than the second number. | codefeedback |
Define a function which takes two strings as arguments and returns a list containing all characters that appear in either string, excluding any duplicate characters.
string_1 = 'Apple'
string_2 = 'Banana'
# Test Case 1:
# The characters 'A', 'p', 'l', and 'e' appear in string_1, while the characters 'B', 'a', and 'n' ... | codefeedback |
Generate an array containing numbers between 1 and 100 that are divisible by both 5 and 7, with a time complexity of O(n) and space complexity of O(1). | codefeedback |
Design a responsive HTML document that displays a dynamic chart representing the sales of a particular item over a given time period. Implement a feature to allow users to filter the chart based on different criteria such as region, product category, or date range. Additionally, the chart should have interactive toolti... | codefeedback |
You are given two strings of lowercase letters, find the minimum number of operations required to make them equal. You can perform three types of operations:
1. Insert a character
2. Delete a character
3. Replace a character
The cost of each operation is equal to 1. Your task is to determine the minimum cost to trans... | codefeedback |
Write Javascript code to select all div elements with the class "container" that are also descendants of a div element with the id "main". | codefeedback |
Create a class to represent a student's report card. The report card should store the student's grades for multiple subjects, as well as calculate the average grade. The class should have the following methods:
1. `add_grade(subject: str, grade: float)`: Adds a grade for a specific subject. The subject should be a str... | codefeedback |
Explain the concept of Binary Indexed Tree and provide a step-by-step explanation of how to construct and update a Binary Indexed Tree for efficient range queries and updates. | codefeedback |
Write a program in Python to calculate the factorial of a given number. | codefeedback |
Describe the runtime complexity of segment tree and provide an implementation in Java or C++ that supports lazy propagation. | codefeedback |
Formulate a query in SQL that would output the names of products that cost more than $50 and have a quantity in stock greater than 10. | codefeedback |
Design a web page containing HTML/CSS containing at least 5 containers, where each container should display different content based on the user's interaction. The web page should have a responsive layout that adjusts to different screen sizes. Additionally, implement a functionality where the user can drag and drop the... | codefeedback |
Design a data structure to track the frequency of words in a given text, while also maintaining the order of the words in the text. | codefeedback |
Convert the following SPARQL query to a SQL query.
SELECT ?person ?age
FROM person_table
JOIN person_type_table ON person_table.person_id = person_type_table.person_id
JOIN age_table ON person_table.person_id = age_table.person_id
WHERE person_type_table.type = 'Person' | codefeedback |
Write a function in Java to delete duplicate elements from an unsorted array of integers. The function should have a time complexity of O(n), where n is the length of the array. | codefeedback |
Create a function in JavaScript to recursively search for a specific key in a nested JSON object and return its value. The function should handle arrays of objects as well. If the key is not found, the function should return null. | codefeedback |
Answer what is the longest palindrome in a given string. Please provide the length of the longest palindrome as well.
"Run, spot, run. He ran up red hills"
#Reference Error#
Please provide the length of the longest palindrome as well. | codefeedback |
Create a filter to remove all integers from an array of mixed data types, while preserving the order of the remaining elements. The resulting array should only contain strings and floating-point numbers. If there are no strings or floating-point numbers left after the removal, return an empty array. You are not allowed... | codefeedback |
Create a SQL statement to select all rows of the "students" table with a GPA higher than 3.0, ordered by descending GPA. | codefeedback |
Write a code snippet to produce an XML result for a given input data structure. The input data structure may contain nested dictionaries and lists.
For example, given the following input data structure:
{
"key1": "value1",
"key2": {
"key2.1": "value2.1",
"key2.2": "value2.2"
},
"key3":... | codefeedback |
Construct a code to get the last index of a given substring in a string. The substring should be case-sensitive and must be at least two characters long. The input string should contain at least one occurrence of the given substring. If there are multiple occurrences of the substring in the input string, the code shoul... | codefeedback |
Convert this floating-point number to a 12-bit binary number, rounding to the nearest thousandth.
123.46875 | codefeedback |
Write a function in JavaScript that takes two strings as arguments and checks if the characters in the first string form a subsequence of the characters in the second string. The function should also handle cases where the characters in the first string do not appear in the same order in the second string. Additionally... | codefeedback |
Explain the use of the Huffman encoding algorithm and provide a Python code implementation to compress a given string using Huffman encoding. | codefeedback |
For the given matrix, calculate the determinant using a recursive algorithm.
Matrix:
1 2 3
4 5 6
7 8 9
Time Complexity Requirement: O(n!)
Space Complexity Requirement: O(n^2)
Note: You may assume that the matrix is always a square matrix of size n x n, where n is a positive integer. | codefeedback |
Write a C++ program for finding the maximum value in a BST using recursion. | codefeedback |
Generate the Fibonacci sequence up to a given number n in Python. | codefeedback |
Implement a binary classification model using a Support Vector Machine algorithm to predict the likelihood of a customer subscribing to a bank's term deposit based on a given dataset. | codefeedback |
Code a React component that renders a button with the following requirements:
1. The button text should be "Submit" but displayed in uppercase letters.
2. The button should have a background color of #F44336 (Material Design red).
3. When the button is clicked, it should change its text to "Submitting..." and be disab... | codefeedback |
Write a code to delete all records in an MS Access table, but exclude any records where the value of a specific field is equal to a predetermined value. | codefeedback |
Write a JavaScript function that takes a specific date as input and returns the number of milliseconds that have elapsed since that date until the current date and time. The function should account for leap years and should handle time zone differences correctly. | codefeedback |
Create a linux shell script for restarting network interfaces.
Instructions:
1. The script should prompt the user for the name of the network interface to restart.
2. Validate the user input to ensure it is a valid network interface name.
3. If the input is invalid, display an error message and ask the user to enter a... | codefeedback |
How would you reverse the elements in this array without using any additional data structures and in-place? | codefeedback |
How to identify an email address from a given string using Regular Expressions and ensure that it is not part of a URL or inside a comment or string literal? | codefeedback |
Using Java, write a method that takes an array of integers and replaces all the negative numbers with 0. Additionally, the method should ignore any zero values in the array and not replace them. The modified array should be returned as the output.
int[] arr = {2, 0, -4, 5, 7, -8, 0}; | codefeedback |
Create a Java program to output the Fibonacci series up to the given number. The program should prompt the user to enter the number of terms in the series and validate the input to ensure it is a positive integer. If the input is not valid, the program should display an error message and ask the user to enter a valid n... | codefeedback |
Using SQL, write a query to identify the student ID and the name of the student who scored the highest marks in each subject across multiple semesters. Include the semester information in the result as well. | codefeedback |
Create an HTML webpage that displays a table containing a list of students and their corresponding grades. The webpage should also include a button that allows the user to sort the table by the students' names in alphabetical order. Additionally, implement a search functionality that allows the user to search for a spe... | codefeedback |
Given two arrays of integers, write a Python function which is able to identify common elements. However, you are not allowed to use any built-in functions or libraries, such as set() or intersection(), to find the common elements. You must come up with your own algorithm to solve the problem.
arr1 = [1,2,3,4,5]
arr2 ... | codefeedback |
Write a function which prints out the odd numbers from a given list in descending order. The function should also display the sum of all the odd numbers.
For example, given the list [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], the function should print:
9
7
5
3
1
The sum of the odd numbers is: 25
Note: You should not use any b... | codefeedback |
Design a class named "Rectangle" that prints out the length, width, area and perimeter of a given rectangle. Additionally, implement a method called "isSquare" that returns true if the rectangle is a square and false otherwise. | codefeedback |
Using list comprehension, create a new list that contains values less than 5 and are even. Additionally, for each value in the original list, add its square root rounded to the nearest whole number to the new list. Finally, sort the new list in descending order.
my_list = [7, 2, 5, 8, 4, 9, 6] | codefeedback |
Build a REST API with Node.js which provides the current temperature and humidity data of a given location. Additionally, the API should implement token-based authentication to ensure only authorized users can access the data. | codefeedback |
Construct a while loop that continuously adds all elements of a list until reaching a certain number. The sum must be calculated using a recursive function. The list must contain only positive integers. The maximum length of the list is 100. The sum_num must be a positive integer less than or equal to 1000. If the sum_... | codefeedback |
Construct a code that takes in an object and checks whether each property includes a certain value.
The code should have the following steps:
1. Create a function that takes in two parameters: the object to be checked and the value to be searched for.
2. Iterate over each property in the object.
3. Check if the value... | codefeedback |
Create a function to update the existing item of a dictionary with a new value. Additionally, if the value is a list or a dictionary, the function should check for any nested values and update them as well.
For example:
mydict = {
"name": "John",
"age": 25,
"address": {
"street": "123 Main St",
"city": "... | codefeedback |
Make a code that takes two integer arguments and returns the sum of the two integers, but with the following additional requirements:
1. The code should not use any arithmetic operators (such as +, -, *, /) or built-in functions (such as sum()) to perform the addition.
2. The code should handle negative numbers and la... | codefeedback |
Create a SQL query to get the names of all the customers who have purchased at least two products from a specific category within the last 7 days. | codefeedback |
Construct a class which instantiates objects with a given name and age. Implement a method `get_name` which returns the name of the object and a method `get_age` which returns the age of the object. Additionally, implement a method `set_name` which allows changing the name of the object and a method `set_age` which all... | codefeedback |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.