instruction_seed stringlengths 0 26.4k | source stringclasses 4
values |
|---|---|
Write an algorithm for sorting a single-linked list. | codefeedback |
Explain how garbage collection works in Java. | codefeedback |
Suggest an algorithm to implement a stack with two queues. | codefeedback |
Convert a code written in Python 3 into code compatible with Python 2.
input = int(input('Enter your number: ')) | codefeedback |
Rewrite the code to be more concise and efficient.
def find_min(arr):
min_val = float('inf')
for i in arr:
if i < min_val:
min_val = i
return min_val | codefeedback |
Compute a factorial of a given integer.
5 | codefeedback |
Create a function to do a binary search on a sorted list of integers.
nums = [2, 4, 5, 7, 8, 9, 10, 14] | codefeedback |
Find physical address of the code.
Code: 0x7fff2ceb5de5 | codefeedback |
Preprocess a natural language text for text classification.
Text: “The food I ate yesterday was really amazing. I loved the entire experience.” | codefeedback |
Generate a function to identify prime numbers between 0 and n. | codefeedback |
Write a regular expression pattern to match all email addresses with the same top-level domain. | codefeedback |
Explain how recursion works. | codefeedback |
In this C++ program, there is an error. Please identify and fix the mistake.
int main()
{
cout << "Hello World!";
return 0 | codefeedback |
Generate a Fibonacci sequence with a given length.
length = 10 | codefeedback |
You need to design a database for a school where multiple students can have a tutor of a subject. What is the best way to design the database? | codefeedback |
Create a JavaScript program to find the area of a triangle using Heron's formula given the three sides, a, b and c. | codefeedback |
Construct an algorithm to calculate the GCD of two numbers. | codefeedback |
Write a function to find the closest pair of points in a given array of points. | codefeedback |
You have a list of employee records. Each record contains the employee's name, age, salary and department. Write an algorithm to sort the list by age in ascending order. | codefeedback |
Construct an algorithm to find all possible combinations of a string of characters. | codefeedback |
Compare and contrast the features of the two programming languages: Python and Java. | codefeedback |
Create a method that returns all elements in an array that are larger than the given value x.
[2, 3, 5, 7, 11, 13] and x = 4 | codefeedback |
Create an array of 10 non-repeating random integers. | codefeedback |
Print the current system date and time in a readable format | codefeedback |
Create a table of data about each object in the list.
my_list = [{"name": "John", "age": 20}, {"name": "Laura", "age": 30}, {"name": "Harry", "age": 25}] | codefeedback |
Remove the duplicate words in the given string
my_string = "this this is a a sentence" | codefeedback |
Run a regression on the given dataset and print the coefficients | codefeedback |
Write a SQL query to find all customers who purchased more than 5 items from a specific store. | codefeedback |
Construct a generic BST in Swift | codefeedback |
Construct a for loop in Javascript to measure the sum of the squares of integers from 2 to 6 | codefeedback |
Write code in Java for a user input prompt that states "Please enter a number". | codefeedback |
Write code to create a web server in Go. | codefeedback |
Write a function to query a database table 'trips' and return a list of all trips made over the past three months. | codefeedback |
Write an algorithm to find the number of times a given number appears in an array
[5, 2, 4, 2, 5, 2, 5], number: 5 | codefeedback |
Reverse a given string without using built-in library functions | codefeedback |
Using TensorFlow, define a neural network for classifying a set of language data as either English or Spanish.
Training data of 1000 samples with 500 English sentences and 500 Spanish sentences. | codefeedback |
Design a class in Java for creating a 2D point. | codefeedback |
Using an AI platform, create a sentiment analysis model to predict a sentiment of a given sentence. | codefeedback |
Write a code to optimize the parsing of a given sentence using CKY parsing.
Sentence: "The cat chased the dog around the corner of the house." | codefeedback |
Create an animnation of a bouncing ball in the canvas using JavaScript. | codefeedback |
Create a search engine to process natural language queries. | codefeedback |
Write a code for sorting the given array of numbers in ascending order. | codefeedback |
Create a program to detect spam emails. | codefeedback |
Design and implement a genetic algorithm for finding the optimal solution for a given problem. | codefeedback |
Create an AI chatbot that can answer questions about the given topic "Covid-19".
Topic: Covid-19 | codefeedback |
Generate a python program to solve the Tower of Hanoi problem with n discs | codefeedback |
Generate a unique 8 character string that contains a lowercase letter, an uppercase letter, a numerical digit, and a special character. | codefeedback |
Write an algorithm to determine if an input string is a palindrome.
racecar | codefeedback |
Write a code to print the power of 2 up to the given limit.
8 | codefeedback |
Generate a random string of a given length using different uppercase, lowercase characters, and digits. | codefeedback |
Write a query statement to find all employees who joined in the last 5 years. | codefeedback |
Train a logistic regression classifier on the given dataset.
[Dataset details]
This dataset contains information on Belgian bank customers, including their credit score and risk profile. It consists of 1000 rows and 5 columns. The columns are:
- Age
- Credit Score
- Gender
- Risk Profile
- Status | codefeedback |
Implement a neural network in Keras to solve the given classification problem.
[Problem description]
Given a dataset of images containing cats and dogs, create a neural network in Keras to classify the images into one of the two categories. | codefeedback |
Using HTML and JavaScript, implement a drag and drop feature. | codefeedback |
Write an assembly language program to check if a given number is least in its sequence. | codefeedback |
Using Haskell, implement a function to calculate the sum of numbers from 1 to the given number. | codefeedback |
Write a code to classify emails as spam or not-spam using Naive Bayes algorithms. | codefeedback |
Write a code to extract all the hyperlinks from a Wikipedia page. | codefeedback |
Create a React component that accepts a string as a parameter and prints it in the console. | codefeedback |
Determine the most efficient way to sort a complex data structure using Java.
[3, 4, 2, 7, 9, 1, 5] | codefeedback |
Implement a search algorithm in C++ that takes in a list of integers and a target value and finds the index of the target if it exists in the list.
List: [2, 4, 6, 8, 10], Target: 8 | codefeedback |
Transform a given XML document into a JSON object using Python. | codefeedback |
Implement the longest common subsequence algorithm in C. | codefeedback |
Using regular expressions, extract all telephone numbers from a given string in JavaScript. | codefeedback |
Parse a given HTML document and find all elements with the given class name using JavaScript. | codefeedback |
Given two data sets, one containing the user id (user_id) and first name (firstname) and another data set containing user_id and last name (lastname), write a Python function to join the two sets and create a new data set with firstname, lastname and user_id.
user_id: [1,3,4,7]
firstname: ["John", "Alice", "Madison", ... | codefeedback |
Create a class to store student names, ages and grades. | codefeedback |
Write a Python program to find all the Armstrong numbers between the given two numbers. An Armstrong number is a number such that the sum of its digits raised to the third power is equal to the number itself.
lower = 100
upper = 2000 | codefeedback |
Write a virtual assistant in Python to gauge the sentiment of a given string.
string = "I had a terrible day" | codefeedback |
Calculate the square root of a number using bisection search.
number = 9 | codefeedback |
Make a class in Python which will represent a binary search tree. | codefeedback |
Rewrite the following C program so that it prints the frequency of each character in a given string.
string = "abcabcabc" | codefeedback |
Change the following C++ program so that it returns 0 if an array contains all negative numbers.
arr = [-2, -3, -4, -1] | codefeedback |
Design a database schema for a retail store that tracks customers, purchases, and items. | codefeedback |
In Java, what is a good way to make a deep copy of an object? | codefeedback |
Using a single 'for' loop, iterate through an array and print out the indices and values of each element to the console.
[2, 5, 8, 9, 10] | codefeedback |
Write a test suite to test an arithmetic function that takes two arguments and returns the sum. | codefeedback |
Write a Swift program to calculate the factorial of a given integer. | codefeedback |
Compile a given C program and link it with a shared library.
// program code given
#include <stdio.h>
int main()
{
printf("Hello World");
return 0;
}
//Shared Library
libfoo.so | codefeedback |
Write a code to add a new key and value to a given dictionary.
Dictionary: {'name': 'John', 'age': 18, 'city': 'New York'}
New Key: 'profession', Value: 'journalist' | codefeedback |
Design a basic calculator using HTML, CSS, and JavaScript. | codefeedback |
Design a currency exchange program using JavaScript that allows the user to instantly receive the exchange rate for a particular currency. | codefeedback |
Create a web page that displays a message in different languages by using HTML, CSS, and JavaScript. | codefeedback |
Design an interactive game using HTML, CSS and JavaScript. | codefeedback |
How would you write a for loop to iterate over an array of integers in Bash? | codefeedback |
Create a Django application to store and retrieve questions and answers. | codefeedback |
How can the following JavaScript program be modified to include a letter grade for each student score?
let grades = [
{name: 'John', score: 90},
{name: 'Jack', score: 80},
{name: 'Jill', score: 85},
] | codefeedback |
Write a code to identify palindromic numbers between 1 and a given number n. | codefeedback |
Write a code to define a function to multiply two numbers passed as arguments. | codefeedback |
Create a function that takes a list of strings and returns a new list of strings with the first letter of each string as capital.
names = ["mary", "john", "joseph"] | codefeedback |
Replace all punctuation marks in the following sentence with underscores.
She looked up at the stars and got lost in thought. | codefeedback |
Construct a SQL query to find the total salary spending of an organization by employees in the month of June. | codefeedback |
Switch the positions of the first and last element in a list.
list = [1, 2, 3, 4, 5] | codefeedback |
Create a function to sort a list of numbers without using python's built-in sort function.
[3,5,4,2,1] | codefeedback |
Make a program to display the maximum, minimum and average of numbers in a list
[1,2,3,4,5] | codefeedback |
Create a JavaScript class that allows the user to choose the size, position and color of a textbox. | codefeedback |
What is the volume of a sphere with radius 7 cm? | codefeedback |
Create a MySQL query to calculate the total price paid by customer with ID 1 in the last month. | codefeedback |
Explain why the following code snippet produces the output it does
lst = [[1, 2], [1, 2], [3, 4]]
[x for i in lst for x in i] | codefeedback |
Given the following code snippet, write the code to achieve the expected output
def convert_to_title_case(input):
# Expected Output:
# input = "this is a Title"
# Output = This Is A Title | codefeedback |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.