instruction_seed stringlengths 0 26.4k | source stringclasses 4
values |
|---|---|
Create a class that implements a polygon using an array of Point objects. | codefeedback |
Write a function that reduces an array of numbers to a single number.
[2, 4, 6, 8, 10] | codefeedback |
Write a JavaScript function to check if a number is in the Fibonacci sequence. | codefeedback |
Given a dataframe, write a function to add a new column that contains the results of a calculation between two columns.
dataframe = Pandas DataFrame([[1, 2, 3], [4, 5, 6], [7, 8, 9]], columns=['A', 'B', 'C']) | codefeedback |
Why is algorithmic complexity important? | codefeedback |
Given an integer N, write a code that finds the next palindrome of N.
N = 187 | codefeedback |
Define a function that takes a string as input and returns true if it is a valid IP address.
ip_str = "127.0.0.1" | codefeedback |
Design a GUI app to welcome the user and output a message | codefeedback |
Create an algorithm that computes the sum of its maximum K (given) digits
arr = [1, 2, 3, 4, 5], K = 3 | codefeedback |
Is this SQL query valid?
SELECT * FROM foobar ORDER BY name | codefeedback |
Calculate the probability of an event given the following probability of each outcome: (0.1, 0.2, 0.3, 0.4). | codefeedback |
Find the length of the longest common subsequence in the following two strings: "ABCBDAB" and "BDCABA". | codefeedback |
Write a regular expression that matches even numbers within a given string. | codefeedback |
Generate a list of all the prime numbers in the range from 0 to the given number n. | codefeedback |
Given the python code below, reverse the order of the lines to form a valid program.
def myFunc():
print(1)
return
print(2) | codefeedback |
Create an array of 15 random floats in Python between 0 and 1. | codefeedback |
Write a PHP function to describe a variable type given the value.
value: "Hello" | codefeedback |
Implement a custom promise-based JavaScript library. | codefeedback |
Generate a random password with 8 characters long including lowercase letters, uppercase letters, and numbers. | codefeedback |
Remove all HTML tags from a string.
"<h1>Hello World</h1>" | codefeedback |
Print all possible combination and permutations with length 3 for a given array.
[1, 2, 3] | codefeedback |
Design a code in C# to check if the input number is positive, negative or zero. | codefeedback |
Write a Python code to calculate the number of unique combinations of three digits from 0 to 9. | codefeedback |
Write a Python code to print a Pascal's triangle with five rows. | codefeedback |
Create a SQL query that returns the average number of orders per month for customers in California. | codefeedback |
Create an SQL query to find all customers from California who made more than 5 orders. | codefeedback |
Calling a calculator API, what is the output of the query "3 * (9 + 5) / 8"? | codefeedback |
Write an SQL query that returns the sum of all orders sent by customers who were born in the month of May. | codefeedback |
Write a SQL query to find all the entries in a given table that contain a specific“value” in the given column. | codefeedback |
Write a code to delete a 'customer' table from a MySQL database. | codefeedback |
Identify the type of triangle when given three sides
side1 = 10, side2 = 10, side3 = 8 | codefeedback |
Create a React component that updates itself with the current time every second. | codefeedback |
Update the following Java code to print the difference between two dates in years, months and days
import java.time.LocalDateTime;
public class DateTime {
public static void main(String[] args) {
LocalDateTime dateTime1 = LocalDateTime.of(2020,11,5,14,45);
LocalDateTime dateTime2 = LocalDateTime.... | codefeedback |
Write a query with window functions in PostgreSQL to calculate the average salary per department.
salary | codefeedback |
Write a SQL statement to update the age of a customer with a specific ID.
Customer_id = 24, Age = 30 | codefeedback |
Implement a function that takes 2 numbers as parameters and returns the greatest common divisor of both numbers.
a = 20
b = 25 | codefeedback |
Write code to convert a given number expressed in hexidecimal representation to binary. | codefeedback |
Given a list of integers, write a Python program to create a new list that contains the square of every element in the original list. | codefeedback |
Using MongoDB, update the product price for a specific product.
product = {name: “iPhone”, price: 1000} | codefeedback |
Program to swap all even and odd elements in a given array.
my_list = [1, 2, 3, 4, 5, 6, 7, 8] | codefeedback |
Generate a function that takes a given list of strings and orders them by their lengths.
words = ["Python", "programming", "language"] | codefeedback |
Refactor the code to use a recursive algorithm instead of a loop to find the factorial of a given number. | codefeedback |
Explain the concept of recurrence relations in algorithms | codefeedback |
Calculate the total distance traveled by an object with a given initial velocity and acceleration
Initial velocity = 12 m/s
Acceleration = 2 m/s^2 | codefeedback |
What is the Big-O notation of a given algorithm | codefeedback |
Update the following JavaScript code to use object-oriented programming.
const calculator = {
number1: 0,
number2: 0,
add(num1, num2) {
return num1 + num2;
},
subtract(num1, num2) {
return num1 - num2;
},
multiply(num1, num2) {
return num1 * num2;
},
divide(num1, num2) {
return num1 / ... | codefeedback |
Design an algorithm to traverse a tree in level-order. | codefeedback |
Provide a solution for the following coding challenge:
Challenge: Given an array of integers, return the maximum sum of any contiguous subarray of the array.
Example: [34, -50, 42, 14, -5, 86] | codefeedback |
Parse a given HTML string and return a JSON structure.
<html>
<head>
<title>Example Website</title>
</head>
<body>
<h1>Header</h1>
<p>This is a paragraph.</p>
</body>
</html> | codefeedback |
Create a function in JavaScript to find the longest substring in a given string without repeating characters.
String: "abcabcbb" | codefeedback |
Name all the built-in functions in Python | codefeedback |
Compute the prime numbers between 1 to 10 | codefeedback |
Write a code snippet to display the name and age of the oldest person in a list called 'people'.
people = [{'name':'Jone','age':45}, {'name':'Jane','age':37}, {'name':'Jack','age':48}] | codefeedback |
Update the following code to fix a syntax error.
def add_two_number(a,b):
return a + b; | codefeedback |
Use the input data to create a bar chart.
Data: [("Apple", 20), ("Samsung", 16), ("Google", 11), ("Sony", 14)] | codefeedback |
Print prime numbers in the given range.
Lower range: 10
Upper range: 30 | codefeedback |
What is the best way to test for memory leaks in a C++ program? | codefeedback |
Convert the decimal number 595 to hexadecimal representation. | codefeedback |
Write your own version of Fisher-Yates algorithm for shuffling an array. | codefeedback |
Construct a query in SQL to find out how many users have the same name. | codefeedback |
Recreate the same result from the given sample output.
Sample output:
1
11
21
1211
111221 | codefeedback |
Write an application that keeps track of tasks and provides status updates for the tasks. | codefeedback |
Implement the following pseudocode in C language.
sum = 0
for i = 0 to n inclusive
sum += i^2
end | codefeedback |
Write an R command to calculate the standard deviation of the given array.
x = c(3, 4, 5, 7, 8) | codefeedback |
Insert the proper code to convert the given address from string to a dictionary.
address = "901 Grand Absinth Avenue,Anytown, ST, 98765" | codefeedback |
Create an array with 10 random numbers in the range of 1 to 50. | codefeedback |
Reconstruct the given code snippet. | codefeedback |
Generate a random password with a combination of letters, numbers and special characters. | codefeedback |
Calculate the angle of elevation when a ball is thrown upward with initial velocity of 20m/s | codefeedback |
Create a computer algorithm to determine the validity of a sudoku puzzle | codefeedback |
Write a function that accepts an integer value n and creates an n by n matrix, with all elements initialised to zero. | codefeedback |
Compute the sum of numbers in a given tree.
Tree Structure
5
/ \
3 7 | codefeedback |
Implement a decision tree as a class in Python. | codefeedback |
Find the mean of the list of numbers [1,2,3,4,5,6,7] | codefeedback |
Design a function to get the length of the longest increasing subsequence in a given list of integers. | codefeedback |
How would you delete every third element of a given linked list? | codefeedback |
Given a matrix, write a program that finds its determinant in Python.
[[a, b], [c, d]] | codefeedback |
Develop an HTML/CSS code for creating a three column layout with a header, footer and content. | codefeedback |
Write an HTML code snippet to create an interactive dropdown menu. | codefeedback |
Develop a machine learning model in Python to classify emails as either important or not important. | codefeedback |
Create a ReactJS component to display a modal window with a form. | codefeedback |
Develop a PHP code snippet to retrieve all records from a database table "POSTS". | codefeedback |
Create a function to print out a multiplication table of two given multidimensional arrays.
arr1 = [ [1,2] , [3,4] ]
arr2 = [ [5,6] , [7,8] ] | codefeedback |
Suggest a completion for the following code so that all the words in a list are printed in reverse
words = ['hello', 'world', 'my', 'name', 'is', 'john']
for word in words: | codefeedback |
Generate all possible strings of length n using A, B and C
3 | codefeedback |
Build a SQL table to store customer contacts. | codefeedback |
Implement a class to represent a vector, with initial vector and a scaler. Include methods to add, subtract and multiply two vectors. | codefeedback |
In JavaScript, construct a function to count the occurence of an element in an array.
var array = [1, 2, 3, 4, 1];
int element = 1; | codefeedback |
Develop a program to convert an infix expression to prefix notation.
A*(B+C)-D/(E+F) | codefeedback |
Create a function in Python that performs a web scrape and returns the most frequent words from the resulting text. | codefeedback |
Generate a dynamic HTML table displaying 10 random numbers from 1 to 100. | codefeedback |
Construct a SQL query to get all the rows of a table ordered by the largest value in each row first.
SELECT ... | codefeedback |
Describe the differences between the stack and the heap memory in C++. | codefeedback |
How is data stored in a binary tree in C++? | codefeedback |
Develop a new class in Python to represent a Rectangle object with getArea() and getPerimeter() methods. | codefeedback |
Create an SQL table to store information about books and authors | codefeedback |
Write a C program to simulate the producer-consumer problem. | codefeedback |
Implementation the quicksort algorithm using c++. | codefeedback |
Design a data structure to keep track of a student's marks for a given course. | codefeedback |
Write a function to compute the Fibonacci numbers and the sum of their squares. | codefeedback |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.