instruction_seed stringlengths 0 26.4k | source stringclasses 4
values |
|---|---|
Create a class to represent a 3D point(x,y,z). | codefeedback |
Write a query that returns the word and the number of times it appears in the string.
"The quick brown fox jumps over the lazy dog" | codefeedback |
Design a series of methods that would be used to implement a card game | codefeedback |
Rewrite the given recursive Python program as a loop.
def factorial(n):
if (n == 1):
return n
else:
return n * factorial(n-1) | codefeedback |
Suggest an appropriate return data type of the following function that takes an integer array as input.
def find_max(arr): | codefeedback |
Create a JavaScript function to validate an email address with the following conditions. | codefeedback |
Design a program to reverse a string without using the built-in 'reverse' method.
string = "Hello World" | codefeedback |
Develop an algorithm to delete a given node from a linked list.
Node 3 in the list {1->2->3->4->5} | codefeedback |
Write a function that takes a string as an input and returns a list of all the substring of the given string.
string = "hello" | codefeedback |
Take a list of objects as input and return a list with removed duplicates.
objects = [1, 2, 3, 4, 5, 1, 2, 3] | codefeedback |
Generate a JavaScript solution to print all prime numbers between 1 and 50. | codefeedback |
Create a hash function that assigns a unique number to each character of the input string.
Hello World | codefeedback |
Determine the most frequent character in the provided string
Hello World | codefeedback |
Fetch data from the internet using an API call in Python
"https://api.example.com/v1/search" | codefeedback |
Create a function that calculates the length of a linked list.
Linked List: 10 -> 20 -> 30 -> 40 -> 50 | codefeedback |
Construct a class that can be used to check if the braces in an expression are balanced.
expression = "[(}{)]" | codefeedback |
Make a C++ program to delete a node from a doubly linked list at a given position.
Linked List: 84 -> 13 -> 25 -> 48 -> 50
Position: 3 | codefeedback |
Generate a proper HTML page. | codefeedback |
Calculate the Fibonacci sequence of the number 12. | codefeedback |
Write a SQL query which returns the top 10 most popular products in the following "products" table. | codefeedback |
Write a SQL query which returns the number of customers from the following "customers" table that are from France. | codefeedback |
Write a Regular Expression that matches all strings starting with a lowercase 'a' and ending with an uppercase 'Z'. | codefeedback |
Write a class in Python to represent an entry in a contact book. | codefeedback |
Using the standard library to construct a generator that returns the first n prime numbers. | codefeedback |
Implement a web scraper in Python to extract all headlines from a web page. | codefeedback |
Given a string, find the longest substring containing no repeated characters.
"abcabcbb" | codefeedback |
Given a number n, write a program to find the nth prime number. | codefeedback |
Given a starting number, write a program to generate the Fibonacci sequence up to nth number. | codefeedback |
Create a Java program to list all duplicated words in the given string.
He explained the problem in an intelligent and articulate manner. | codefeedback |
Rewrite the following code snippet using a switch-case statement.
if (a == 0) {
result = b * c;
} else if (a == 1) {
result = b + c;
} else {
result = b - c;
} | codefeedback |
Write a SQL query to calculate the standard deviation of student grades from the following table.
Student | Grade
John | 75
Mary | 85
Bob | 80
Jane | 90 | codefeedback |
Analyze the following sentence to determine the type of verb phrase involved.
We have met several times. | codefeedback |
Parse this JSON string into a JSONObject
{
"status": 200,
"message": "OK",
"data": {
"users": [
{
"name": "John",
"age": 20
},
{
"name": "Ken",
"age": 30
}
]
}
} | codefeedback |
Create a list comprehension that outputs a list of odd numbers from a given list of numbers.
numbers = [1,2,3,4,5,6,7,8,9,10] | codefeedback |
Write a JavaScript program to create an array of elements, representing the Fibonacci sequence, up to the given number n. | codefeedback |
Write a code to validate an email entered by the user. | codefeedback |
Generate a regex that detects an email | codefeedback |
Classify and label the outputs from a logistic regression.
[-1, 0.1, 0.6, 1.8] | codefeedback |
Write a code to group the elements in a list into a dictionary with the list element as the key and the number of times the element is repeated in the list as the value.
[1, 2, 2, 2, 3, 3, 4, 4, 5] | codefeedback |
Generate a function to convert an infix expression to a postfix expression.
"A + B * C" | codefeedback |
Write an SQL query that displays the 10 highest paid employees. | codefeedback |
Given a 2D array, transpose the array.
matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] | codefeedback |
Create a function to compute the depth of a binary tree. | codefeedback |
Write a SQL query to find all flights departing from a given location after a given date and time.
StartCity: NYC
Date/Time: March 16, 2021 8:00 AM | codefeedback |
Edit the following code to use more efficient algorithms to improve its performance.
for (int i = 0; i < n; i++)
{
sum += i;
} | codefeedback |
Observe the given piece of code and suggest the possible data structure to use.
for (int i = 0; i < input.length; i++)
{
if (input[i] == 0)
{
output[output_index] = i;
output_index++;
}
} | codefeedback |
How would you go about sorting a million numbers in memory? | codefeedback |
Create a program to generate all subsets of a set.
input_set = {1, 2, 3} | codefeedback |
Write a function to make an API call to the Yelp API to return the list of top 10 restaurants near a given address.
Address: 1234 Main Street, San Francisco, CA | codefeedback |
Find the longest substring containing only digits from within the given string.
String: This string contains 11111 and 123456 | codefeedback |
Train a classification model to classify the sentiment of the given sentence.
Sentence: I love this new book! | codefeedback |
What is an example of an algorithm for solving Sudoku? | codefeedback |
What is a heuristic for solving the traveling salesman problem? | codefeedback |
Design an algorithm to find the longest substring with no repeating characters in a given string.
"abcabcbb" | codefeedback |
Using any programming language, write a program which takes a number as an input and outputs the first two prime numbers after it.
7 | codefeedback |
Write a function in Java to delete all numbers from an array which are divisible by three.
[1, 2, 3, 4, 5, 6, 7, 8, 9] | codefeedback |
Create a JavaScript program which takes an array of dates and returns the average date.
[2018-01-01, 2018-01-05, 2018-01-10] | codefeedback |
Construct a C++ program to find the maximum value in an array of integers.
int array[] = {1, -2, 3, 4, 7, 5} | codefeedback |
Write an SQL query to find the longest length of movies in a database called "Movies". | codefeedback |
Express the following in a for loop
Print the squares of all the numbers from 1 to 10 | codefeedback |
Write a function which takes a number and returns the Fibonacci sequence up to that number.
n = 10 | codefeedback |
Create a function which swaps the values of two list elements at a specific index.
my_list = [1, 2, 3]
index1 = 0
index2 = 2 | codefeedback |
Create a program to return all the prime numbers under the nth number.
n = 10 | codefeedback |
Implement a function in C++ to return the inverse of a given 2-D array.
[[1, 2], [3, 4]] | codefeedback |
How would you create a function to calculate factorial of a given number in Python? | codefeedback |
Delete all comments that start with the string '#' from the given text.
The following program writes "Hello World!" to the screen. # This is a comment | codefeedback |
What is the best way to format a large number such that it is easy to read? | codefeedback |
Create a program to output the squares of all numbers between 1 and 100. | codefeedback |
Generate HTML code to create a login page with a username and password field. | codefeedback |
Create a class in Java for representing a Rectangle that stores length and width attributes and a method to calculate its area. | codefeedback |
Create a SQL query to group the table by age and calculate the average salary of each group.
Table name: employees
Fields: name (varchar(255)), age (int), salary (int) | codefeedback |
Construct a JavaScript program to find all the prime numbers within a range of numbers
range = [2,10] | codefeedback |
Train a model in PyTorch to classify the following dataset into 4 classes. | codefeedback |
Compare and contrast SQL and NoSQL databases. | codefeedback |
Build a function to convert an adjacency matrix into an adjacency list.
A =
[[0, 1, 0, 0],
[1, 0, 1, 1],
[0, 1, 0, 0],
[0, 1, 0, 0]] | codefeedback |
Mark the output of the following two lines of C++ code
int a = 10;
int b = ++a + ++a; | codefeedback |
Find the number of unique subsets of a given set
given_set = {1, 2, 3} | codefeedback |
Parse the given XML document.
<?xml version="1.0" encoding="UTF-8"?>
<bookstore>
<book>
<title>A Game of Thrones</title>
<author>George R. R. Martin</author>
<price>9.99</price>
</book>
<book>
<title>A Clash of Kings</title>
<author>George R. R. Martin</author>
<price>12.99</price>
... | codefeedback |
Write a shell script to monitor the usages of CPU and RAM. | codefeedback |
Develop a Django application to store car model, make and year in the database. | codefeedback |
Build a quickly-sortable tree from a given array.
Array = [3, 8, 4, 5, 2, 10, 7] | codefeedback |
Design a class for a grocery store inventory management system. | codefeedback |
Given two strings, find the minimum number of operations required to convert one string to the other.
String 1 = "horse"
String 2 = "ros" | codefeedback |
Implement a function to perform in-place array rotation.
arr = [1, 2, 3, 4, 5]
rotation = 2 | codefeedback |
Manipulate a string in C++ to delete all special characters from it.
String = “Hello!&@ This#%^$ is a string” | codefeedback |
Write a function to traverse a tree using depth-first search algorithm in Java. | codefeedback |
Suppose a set of n numbers and write a program to calculate the median
int[] numbers = {3,7,5,14,15,17}; | codefeedback |
How would you test a Turing machine? | codefeedback |
Construct an algorithm to detect a cycle in a linked list | codefeedback |
Write a function to get a string made of the first and last two characters of a given string.
input_string = "spring" | codefeedback |
Return the maximum number of 256-bit numbers that fit in a 1GB RAM. | codefeedback |
What is the maximum number of nodes in a full binary tree with a given height?
Height: 4 | codefeedback |
Create a tower of stars made up of 10 lines of increasing star lengths. | codefeedback |
Change the background color of all element with the class "container" to blue. | codefeedback |
Write an algorithm to search for numbers in an array and replace them with their square roots.
[1,2,3,4,5] | codefeedback |
Design a program to detect an infinite loop in a given program. | codefeedback |
Describe a good object oriented design approach for the following problem statement:
Design an application that provides a way for users to store and access their banking records. | codefeedback |
Acquire the necessary data to apply linear regression on the following problem statement
Predict the average property value in a particular city given population density, housing costs and average income. | codefeedback |
Create a Django application to serve an API endpoint
The API endpoint should take an ID and return a user's name and age. | codefeedback |
Design an algorithm to help a user navigate through a maze | codefeedback |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.