instruction_seed stringlengths 0 26.4k | source stringclasses 4
values |
|---|---|
Create a project in C# to read from a database, apply complex data transformations, and display the results in a table.
Requirements:
1. Read data from a database table containing information about employees. The table should have the following columns: EmployeeID (int), FirstName (string), LastName (string), Age (int... | codefeedback |
Write a Python script to combine two given list of strings, while ensuring that the resulting list does not contain any duplicates.
list1 = ["Python", "Ruby", "JavaScript"]
list2 = ["C++", "C#", "GO"]
In addition to combining the two lists, you need to check if any string in the resulting list is already present, and... | codefeedback |
Using the data provided below, create an SQL query to find the first name, last name, age, and salary of all employees who are between the ages of 35 and 45, and have a salary higher than $50,000. Additionally, order the results by salary in descending order.
Table: employees
Columns: first_name, last_name, age, salar... | codefeedback |
Create an array with 10 numbers 0-9 randomly, ensuring that each number appears exactly twice. | codefeedback |
Create an HTML page using JavaScript that generates a table with the following data.
const data = [
{
name: "John Doe",
age: 30,
city: "New York"
},
{
name: "Jane Smith",
age: 25,
city: "San Francisco"
},
{
name: "Adam Johnson",
age: 27,
city: "Los Angeles"
}
];
However... | codefeedback |
Create a Python script that asks the user to input an integer number greater than 1 and less than 100, and display the sum of all the preceding numbers. Additionally, the program should only allow the user to input a number that is divisible by 3. | codefeedback |
Write a SQL query to find customers who have made at least 5 purchases in the last 3 months, are from the state of California, and order the list by their average purchase amount in descending order. | codefeedback |
Write a Python script to extract text from a given PDF page and count the number of unique words in the extracted text. The script should ignore any special characters, punctuation marks, and numbers while counting the words. Additionally, the script should display the top 5 most frequently occurring words in the extra... | codefeedback |
Create a responsive HTML page that displays a grid of images fetched from an API. The grid should have a dynamic number of columns based on the screen size, with a maximum of 4 columns. Implement infinite scrolling to load more images when the user reaches the bottom of the page. Additionally, implement a search bar th... | codefeedback |
Write a C# method that takes a string and returns the character count, but with the following additional conditions:
1. The method should only count alphabetical characters (A-Z, a-z). Any non-alphabetical characters should be ignored.
2. The method should be case-insensitive, meaning that uppercase and lowercase char... | codefeedback |
Write a Python function that validates a given credit card number and returns the type of the credit card (Visa, MasterCard, American Express, Discover) based on the card number prefix.
You can assume the following card number prefixes:
- Visa: starts with 4
- MasterCard: starts with 51, 52, 53, 54, or 55
- American E... | codefeedback |
Implement an abstract class named "Shape" with the following requirements:
1. It should have an abstract method named "calculateArea" that returns a float.
2. It should have a concrete method named "printArea" that prints the calculated area of the shape.
3. It should have a constructor that takes two parameters - "len... | codefeedback |
Write a TensorFlow script to build a 5-layer neural network classifier with dropout regularization. | codefeedback |
Generate a list of 10 random integers between 50 and 100, ensuring that all numbers in the list are unique. | codefeedback |
Create an algorithm to detect if a given sentence contains any words that are offensive. The offensive words are provided in a list, and they can be a combination of single words or phrases. The algorithm should handle variations in capitalization and punctuation.
Example sentence: "This stupid jerk is a complete moro... | codefeedback |
Write a Python function to return an array of adjacent (horizontal, vertical, and diagonal) numbers of a given two-dimensional array. | codefeedback |
Write a function to construct a new string by appending the provided string to itself, but each character in the original string should be repeated twice in the new string.
Example:
my_string = 'Hello'
Output: 'HHeelllloo' | codefeedback |
Create a Python class to represent the 'Employee' entity. The class should have the following attributes:
- name: a string representing the name of the employee
- age: an integer representing the age of the employee
- salary: a float representing the salary of the employee
The class should also have the following meth... | codefeedback |
Create a function that outputs a nested dictionary from a given list of keys and values. The function should handle cases where the list of keys is nested. The function should also have a time complexity of O(n), where n is the length of the input list of keys.
Example:
list_keys = ["a", ["b", "c"], "d"]
list_vals = ... | codefeedback |
Create a function to count the number of characters in a string, without using the len() function. Your function should also ignore any whitespace characters in the string. Additionally, your function should be case-sensitive, meaning it should count uppercase and lowercase letters as different characters. | codefeedback |
Given a comma separated string, write a Python program to convert the string into a list while ignoring any leading or trailing spaces. The program should also handle empty strings gracefully and return an empty list in such cases.
Additionally, the program should check if the input string contains any duplicate eleme... | codefeedback |
Create a function that returns the `n`th number in the Fibonacci sequence, but with an additional constraint: you cannot use recursion or iteration to solve the problem. You must come up with a solution that uses a mathematical formula or algorithm to calculate the Fibonacci number directly. | codefeedback |
Write a SQL query to find the maximum and minimum salaries of employees who have been with the company for at least 5 years and have received a performance rating of 4 or higher. | codefeedback |
Create a function to detect if two given strings are anagrams or not. An anagram is a word or phrase formed by rearranging the letters of another word or phrase. The function should return True if the two strings are anagrams, and False otherwise.
str1 = 'abc'
str2 = 'bac'
# Additional Requirements:
1. The function s... | codefeedback |
Modify the Java program below so that it prints the sum of two given numbers. However, you are not allowed to use the "+" operator or any other arithmetic operator to perform the addition.
int num1 = 3;
int num2 = 5; | codefeedback |
Write a function to find the highest prime number that can be divided by a given number, and is also a palindrome. | codefeedback |
Convert a given string to camel case. The input string may contain special characters and numbers. Ensure that the camel case string starts with a lowercase letter. | codefeedback |
Create a function that takes two strings and removes all the white spaces from them. The function should also remove any leading or trailing spaces. The final strings should be converted to lowercase before being returned. Additionally, the function should check if the input strings are alphanumeric and raise an except... | codefeedback |
Describe an effective way to debug a complex JavaScript program that involves asynchronous functions and multiple external API calls. | codefeedback |
Fill in the missing code so that it prints the sum of the second and third elements of each list, and returns a list of the sums.
my_list = [[1,2,3],[4,5,6],[7,8,9]] | codefeedback |
Suggest a solution to the following problem: given an array of numbers, find all pairs of numbers whose product is equal to the given target number. The time complexity of the solution should be O(n^2) or better. The array can contain both positive and negative numbers.
arr = [1, 5, 3, 2, -2, -1, 6, -3, 0], target = 10 | codefeedback |
Generate a program to reverse a user inputted string, but without using any built-in string reversal functions or methods. | codefeedback |
Implement a function that will sort the array using insertion sort.
Write a function named `insertion_sort` that takes in a list of integers called `nums`. The function should sort the list in ascending order using the insertion sort algorithm and return the sorted list.
The insertion sort algorithm works as follows:... | codefeedback |
Compare two arrays in JavaScript and return true if they have the same elements in the same order, false otherwise. The arrays can contain any type of values, including nested arrays and objects. Additionally, the solution should not use any built-in JavaScript array methods such as 'sort', 'filter', or 'includes'. | codefeedback |
Implement a function that will return the intersection of two given arrays.
arr_1 = [2,3,4,7,9,10,12]
arr_2 = [1,3, 5, 6, 7, 9, 11, 12, 13]
Additional Requirements:
1. The function should have a time complexity of O(n), where n is the total number of elements in both arrays.
2. The function should have a space complex... | codefeedback |
Create a function that takes two strings as arguments, and decides if either of them is a palindrome. A palindrome is a word, phrase, number, or other sequence of characters that reads the same forward and backward.
The function should first check if both strings are valid and not empty. If either of them is empty or ... | codefeedback |
How can we improve the following model to achieve better performance and accuracy?
import keras
from keras.models import Sequential
from keras.layers import Dense, Dropout, Flatten, Conv2D, MaxPooling2D
model = Sequential()
model.add(Conv2D(64, kernel_size=(3, 3), activation='relu', input_shape=(128, 128, 3)))
model.... | codefeedback |
Write an SQL query to return the customers whose purchases include both productid 100 and 101, and the total quantity of each product purchased must be greater than or equal to 10. | codefeedback |
Write a Python script to generate Fibonacci sequence upto n, but the sequence should be generated using a recursive function instead of a loop. | codefeedback |
Write a recursive code that performs binary search on a given sorted list.
my_array = [1,3,5,7,9]
The binary search algorithm should return the index of the target element if it is present in the list, or -1 if it is not present.
Please note the following additional requirements:
1. Your code should have a time comp... | codefeedback |
Write a Python script to print out the max and min values from the given list of integers and display an error message if the list is empty. If the list contains duplicate values, print out the frequency of each duplicate value along with the value itself.
Example Input:
[2,10,18,24,36,95,18,36,24,10,2]
Example Outp... | codefeedback |
Write a code to sort a list of integers from smallest to largest, but without using any built-in sorting functions or algorithms. | codefeedback |
Write a function to shift the elements of a list by a specified number of positions to the left.
Example:
shift_list([2, 4, 6, 8], 2) should return [6, 8, 2, 4]
Additional Requirements:
- The function should handle negative shift values, shifting the elements to the right instead.
- The function should handle shift v... | codefeedback |
Design a class in Java to build a Balanced Binary Search Tree. | codefeedback |
Write a function to parse a given string and construct a dictionary which contains each word and the corresponding frequency. The function should exclude common English stop words such as 'the', 'and', 'or', 'is', 'a', etc. from the dictionary. Consider using a pre-defined list of stop words for this purpose.
my_strin... | codefeedback |
Write a Python function that takes in two lists as input and returns a new list that contains all the elements from both lists. The function should concatenate the lists using a for loop and without using any built-in methods such as `extend()` or `+`. The time complexity of the function should be O(n), where n is the ... | codefeedback |
How can we evaluate a given Python expression dynamically, ensuring that it does not exceed a certain length limit and returns a specific data type? | codefeedback |
Create a Bash script to find the sum of all the numbers divisible by 3 and 5 in a given list.
Reference erroneous code:
```bash
numbers=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
sum=0
for i in ${numbers[@]}
do
if (( i % 3 == 0 && i % 5 == 0 ))
then
sum=$((sum + i))
fi
done
echo "Sum: $sum"
```
However, t... | codefeedback |
How can we remove duplicate elements from a given array while maintaining the original order of elements and without using any additional data structures? | codefeedback |
Write a SQL query to list the top 5 most used languages by developers, excluding any language that has less than 1000 developers using it. | codefeedback |
Write a program that reads a string from the user and checks if it is a valid UK postcode. A valid UK postcode should follow the following format:
- The postcode consists of between 5 and 7 characters.
- The first one or two characters are alphabetic.
- The following one or two characters are numeric.
- There is a sp... | codefeedback |
Create an R function to find the mode of a given data set, where the data set may contain both numeric and character values.
data.set = c(1,2,3,3,3,4,5, "a", "b", "c", "c")
Erroneous code reference:
#Erroneous Code#
mode = function(data.set) {
unique_values = unique(data.set)
counts = table(data.set)
mode = uniq... | codefeedback |
Create a dynamic HTML page that allows users to search and filter a table of the 10 most disruptive technologies of all time based on specific criteria, such as year of introduction, industry impact, or geographical origin. Additionally, implement sorting functionality to allow users to sort the table by different colu... | codefeedback |
Modify the following SQL query to list all the job titles that start with the letter "A" and contain at least one vowel. | codefeedback |
Write a TensorFlow code to classify MNIST with the following requirements:
1. Use a convolutional neural network (CNN) architecture instead of a simple feedforward neural network.
2. Implement data augmentation techniques such as rotation, translation, and scaling to increase the robustness of the model.
3. Utilize ba... | codefeedback |
Print out all the numbers between 1 and 100 that are divisible by 3, but not by 5. | codefeedback |
Write a JavaScript program to simulate a coin toss with the following additional constraints:
1. The program should keep track of the total number of heads and tails tossed.
2. The program should continue simulating coin tosses until a certain number of heads or tails is reached.
3. The program should also display the ... | codefeedback |
Create a function in Scala that takes a parameter x and returns the square of x. Additionally, the function should check if x is a positive number and if it is divisible by 3. If x is not positive or not divisible by 3, the function should return an error message instead of the square. | codefeedback |
Encrypt a given string using AES encryption algorithm and convert the encrypted output to hexadecimal format.
String: 'Hello, world!'
Key: '1234' | codefeedback |
Sum up an array of numbers to a single number using JavaScript. The array may contain negative numbers and floating-point numbers as well. The resulting sum should be rounded to the nearest integer.
Example input: [1, -2.5, 3.7, 4]
Example output: 7 | codefeedback |
Create a function in Rust that takes two strings and returns true if they are anagrams. The function should ignore any special characters and white spaces in the input strings. The function should also be case-insensitive. Additionally, the function should handle strings with non-ASCII characters. | codefeedback |
Write a SQL query to get the names, ages, and addresses of all the people who are 25 years old and live in the United States. | codefeedback |
You need to reverse the following array using JavaScript. However, you are not allowed to use the built-in reverse() method or any other array manipulation methods.
Original array: [1,3,5,7]
Reversed array: [7,5,3,1] | codefeedback |
Write a code using PHP to calculate the difference between two dates, considering leap years and time zones. The dates to be compared are May 27th, 2020 at 9:30 PM GMT+2 and June 11th, 2020 at 10:45 AM GMT-3. | codefeedback |
Read an array of numbers from the user and return the contents in a single comma-separated string in JavaScript. The input array may contain negative numbers and floating-point numbers. The output string should have the numbers formatted to two decimal places. If the array is empty, return an empty string.
For exampl... | codefeedback |
Create a Node.js server that serves up a webpage when a GET request is received. The webpage should be dynamically generated and include real-time data from an external API. The server should also implement user authentication using JWT tokens. | codefeedback |
Describe the steps involved in implementing the Insertion Sort algorithm and analyze its time complexity. | codefeedback |
What is the difference between preemptive multitasking and non-preemptive multitasking? Please provide examples of programming languages or operating systems that use each type of multitasking and explain how they handle task scheduling and resource allocation. | codefeedback |
Write a Bash script for installing multiple packages, but ensure that the script checks if the packages are already installed before attempting to install them. Additionally, the script should log the installation process and any errors encountered during the installation. The package list should include at least five ... | codefeedback |
Given a string and an integer, write a code to find the index of the first occurrence of a specific subsequence of characters represented by the integer in the string. The subsequence should consist of the digits in the integer concatenated in ascending order. For example, if the integer is 321 and the string is "12345... | codefeedback |
Create a Java method to print a two-dimensional array in a spiral order. The array will always have an odd number of rows and columns. The method should start printing from the top left element and move in a clockwise direction. | codefeedback |
Create a function in Python to generate a Fibonacci sequence using matrix exponentiation. | codefeedback |
Write a code in SQL to create a database table tbl_Users which contains two columns 'name' and 'age'. Additionally, the 'name' column should only allow alphanumeric characters and have a maximum length of 20 characters, while the 'age' column should only allow positive integer values between 18 and 65. | codefeedback |
Generate a Ruby code to find the reverse of a given string, but you are not allowed to use any built-in string manipulation methods or loops. | codefeedback |
Train a machine learning model for text categorization with an input text and labels.
Text = "This is an example of text"
Labels = ["example", "text"]
1. Preprocess the input text by removing stopwords, punctuation, and converting all characters to lowercase.
2. Tokenize the preprocessed text into individual words.
3.... | codefeedback |
Write a code in PHP to convert Celsius to Fahrenheit. However, you are not allowed to use any mathematical operators or built-in functions for the conversion. You can only use basic arithmetic operations such as addition, subtraction, multiplication, and division. | codefeedback |
Generate a C code to calculate the power of a given number using a recursive function. | codefeedback |
Create an algorithm to calculate the Fibonacci series up to n numbers where n is a given number. Additionally, ensure that the algorithm is able to handle large values of n (e.g. n > 1000) efficiently without causing a stack overflow or excessive computation time. | codefeedback |
Generate a Java code to display the multiplication table from 1 to 20, including both rows and columns.
#Additional Instructions#
1. Use nested loops to generate the multiplication table.
2. Format the output in a tabular format, with appropriate spacing between numbers.
3. Include a header row and column to label the... | codefeedback |
Create a loop in Java for printing all elements of an array of strings in reverse order.
["String4", "String3", "String2", "String1"] | codefeedback |
Implement a binary search algorithm with a given input array. The array will always be sorted in ascending order. The array may contain duplicate elements.
arr = [2, 3, 4, 8, 10, 10, 42, 56, 78, 89]
Note: The binary search algorithm should return the index of the first occurrence of the target element if it is present... | codefeedback |
Create a program to accept two strings and find if one string is a substring of the other or not. However, in this case, you cannot use any built-in string searching functions or libraries.
You need to implement your own algorithm to determine if one string is a substring of the other. The algorithm should consider al... | codefeedback |
What is the best data structure for searching a value in a large set of data that contains duplicate values and requires constant time complexity for both searching and insertion operations? | codefeedback |
Write a Java program to implement a stack using a linked list.
In addition to the basic functionalities of a stack (push, pop, peek), you should also implement the following methods:
1. isEmpty(): Returns true if the stack is empty, false otherwise.
2. size(): Returns the number of elements in the stack.
3. clear(): ... | codefeedback |
How would you remove all punctuation marks in a given string, while ignoring any punctuation marks within quotation marks? | codefeedback |
How would you implement an algorithm to detect syntax errors in a given Java code, while ensuring that the time complexity is O(n) and the space complexity is O(1)? | codefeedback |
Pack a dictionary with the key-value pairs {'a':1, 'b':2, 'c':3, 'd':4} into a list, but ensure that the resulting list is sorted in descending order based on the keys. | codefeedback |
What type of sorting algorithm can be used to sort a list of integers without using comparisons, and explain how it works step by step? | codefeedback |
Create a code snippet to print the words "hello world" three times, but each occurrence must be capitalized and separated by a comma. Additionally, the code must use a loop to print the words instead of repeating the print statement three times. | codefeedback |
Write a Python program to efficiently explore a large dataset containing 1 million records and perform the following tasks:
1. Read the dataset from a CSV file.
2. Filter the records based on a specific condition (e.g., values greater than a certain threshold).
3. Sort the filtered records based on a specific attribut... | codefeedback |
Perform string manipulation to generate the word 'happy' by starting with the word 'sad' using a recursive approach. The time complexity should be O(n), where n is the length of the input string. | codefeedback |
Generate a random alphanumeric string of length n in Java, where n is an input provided by the user. The generated string should include at least one uppercase letter, one lowercase letter, one digit, and one special character. The time complexity of the solution should be O(n), and the space complexity should be O(1). | codefeedback |
Create an array of strings sorted by the number of vowels in each string. | codefeedback |
Write a piece of code to merge two arrays into one, ensuring that the resulting array is sorted in ascending order.
array1 = [ 1, 3, 5]
array2 = [ 2, 4, 6]
#Additional Reasoning Steps#
1. Merge the two arrays into a new array, maintaining the order of elements from both arrays.
2. Sort the new array in ascending order... | codefeedback |
Use the given JSON object to create a JavaScript function which will output the total number of "users" whose age is between 30 and 40, inclusive, in the provided JSON object. | codefeedback |
Generate a random series of 10 numbers between 1 and 1000, with no repeated numbers. | codefeedback |
Update the program to print the sum of two numbers given as input. The program should also display a message if the sum is greater than 100. Additionally, the program should validate that the inputs are integers and prompt the user to re-enter the numbers if they are not. Finally, the program should track the number of... | codefeedback |
Write a C++ function to calculate the maximum subarray sum of a given array in O(nlogn) time complexity. | codefeedback |
Generate a unique number from given two numbers such that the resulting number is a multiple of both numbers and is also a perfect square.
Number 1: 12
Number 2: 24 | codefeedback |
Write a mySQL query to find all the rows with a particular value in a column, while also sorting the result in descending order based on another column called "last_name". | codefeedback |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.