instruction_seed stringlengths 0 26.4k | source stringclasses 4
values |
|---|---|
Write a Python program that finds the longest common subsequence of two strings.
str1 = "ABGXABCAB"
str2 = "ZXABGAYBCB" | codefeedback |
Write a JavaScript code that implements a binary search algorithm.
arr = [1, 3, 5, 7, 9, 11]
target = 11 | codefeedback |
Write a C++ code that implements the selection sort algorithm.
arr = { 7, 4, 3, 1, 9 } | codefeedback |
Construct an SQL query to add a new column called "Gender" to the table "Employees" with values Male and Female. | codefeedback |
Suggest the missing code to open a connection with a MySQL database in PHP. | codefeedback |
Differentiate the methods of machine learning and explain the differences. | codefeedback |
Explain how a support vector machine works. | codefeedback |
Using python, implement a method to find the longest common subsequence in two strings
str1 = "AGGTAB"
str2 = "GXTXAYB" | codefeedback |
Generate a random string with the a capital letter followed by two lower case letters. | codefeedback |
Develop an algorithm to print all the possible n-ary trees with a given number of nodes.
n=4 | codefeedback |
You need to write an algorithm to find the third largest value in a Binary Search Tree.
8
/ \
3 10
/ \ \
1 6 14
/ \ /
4 7 13 | codefeedback |
Write a function to find all elements that appear more than once in a given array.
[1, 3, 2, 3, 8, 9, 10] | codefeedback |
Create a script to delete all system logs. | codefeedback |
Classify three objects using a decision tree algorithm written in JavaScript.
Object 1: round, red, 5cm
Object 2: square, green, 10cm
Object 3: triangular, red, 8cm | codefeedback |
Modify a given shell script to generate a text-based report of the commands run in the bash shell. | codefeedback |
Write a Java program to find all pairs of integers from an array whose sum equals a given number. | codefeedback |
Train a Random Forest classifier in Python on the Iris dataset. | codefeedback |
Rewrite the following if-statement into a switch statement.
if (grade == "A") {
gradeValue = 4.0;
}
else if (grade == "B") {
gradeValue = 3.0;
}
else if (grade == "C") {
gradeValue = 2.0;
}
else if (grade == "D") {
gradeValue = 1.0;
} | codefeedback |
Create a for loop in JavaScript to loop backwards from 10 to 1. | codefeedback |
Create a function in Python to add two numbers, which may take any number of arguments. | codefeedback |
Write a stack class in Java. | codefeedback |
Implement a DFS algorithm for a tree data structure. | codefeedback |
Construct a data mining program to mine public internet data.
Twitter datasets | codefeedback |
Create an algorithm that sorts a given list of numbers.
[1, 5, -3, 0, 8] | codefeedback |
Create an algorithm to implement a stack using a single queue. | codefeedback |
Create a JavaScript program to make a TCP connection to the server. | codefeedback |
Write a C++ program to rotate an array by 'k' positions.
int arr[] = {1, 2, 3, 4, 5};
int k = 2; | codefeedback |
Given the following nested loop structure, write code to print all elements in the array.
arr = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] | codefeedback |
Modify the following given program to print all prime number between 1 and n | codefeedback |
Write a code to retrieve tweets from a specific Twitter account by using their API.
Twitter account: "@twitter" | codefeedback |
Create a text classifier using a Random Forest algorithm.
[['Ready Player One', 'Adventure'],
['IT', 'Drama'],
['Halloween', 'Horror'],
['Pirates of the Caribbean', 'Adventure']] | codefeedback |
Design a linked list data structure. | codefeedback |
Print the duplicated items in an array of integers.
array: [1, 2, 3, 2, 5, 1] | codefeedback |
Given a string and two words, write a program to find the shortest sub sequence containing both words.
String: the quick brown fox jumps over the lazy dog
Two words: quick and dog | codefeedback |
Implement a search algorithm to search a node in a binary search tree. | codefeedback |
What is the Big O notation of the algorithm you wrote in Task 8? | codefeedback |
Write a code to traverse a matrix in spiral form. | codefeedback |
Create a switch statement to convert an RGB value to HEX.
rgb = (255, 205, 100) | codefeedback |
Find the longest substring of two characters that is a palindrome.
string = "banana" | codefeedback |
Create a class in Python and define several functions for that class. | codefeedback |
Given an array of integers, write an algorithm to find the maximum difference between any two elements in the array.
nums = [3, 2, 7, 1, 4] | codefeedback |
Create a list in Python of elements 0-9 in random order. | codefeedback |
Design a data structure to store books that keeps track of page numbers. | codefeedback |
Calculate the number of valid permutations of length n with respect to a given set of n distinct elements.
n=5 | codefeedback |
Calculate the total product of all numbers in an array in JavaScript.
[5, 4, 2] | codefeedback |
Write an algorithm to print all possible combinations of balanced parentheses. | codefeedback |
Create an array of the first 10 natural numbers in JavaScript. | codefeedback |
Write code to sort a Python list of tuples based on their second element in the tuple.
list_of_tuples = [('a', 5), ('b', 1), ('c', 10)] | codefeedback |
Create a SQL query to select the maximum salary for each department from the "Salary" table. | codefeedback |
Modify the above C program to reverse a sentence. | codefeedback |
Write a C++ program to generate Fibonacci numbers up to a maximum of n values.
n = 20 | codefeedback |
What is a hashmap, and what is it used for? | codefeedback |
You are given two strings, A and B. Write a function to delete the characters in A that also appear in B.
A = 'abcbbdef'
B = 'abcdc' | codefeedback |
Explain the principle of dynamic programming. | codefeedback |
Classify a given paragraph as having a positive or negative sentiment
The customer service was horrible and the wait was too long. | codefeedback |
Write a function in Java to sum up all the elements in a two-dimensional array
int arr[][]={{1,2,3},{4,5,6}}; | codefeedback |
Train a SVM model on the given input data to classify the output as either "yes" or "no".
x1, x2, y
2, 3, Yes
3, 4, Yes
3, 5, No | codefeedback |
Design a PHP class that can be used to store a user's name, age and gender. | codefeedback |
Give an algorithm to delete a key, say k, from a binary search tree (BST). | codefeedback |
Create a SQL query to find the total payments made a group of customers in the last 30 days. | codefeedback |
Implement an algorithm to find all the sets of three numbers in an array which adds up to a given number.
Array: [2, 5, 8], Number: 10 | codefeedback |
Write a SQL clause to get all the records from a table if the value in each column is greater than 5. | codefeedback |
Code a function in Python to calculate the nth value of the Fibonacci sequence. | codefeedback |
Create an SQL query to search for customer names whose age is greater than 30 | codefeedback |
Build a web scraper in Python to fetch the restaurant details from the website.
<uri of the website> | codefeedback |
Develop a function in Java to display the prime numbers between 0 and 100. | codefeedback |
Develop a program to spell a given word.
"Hello" | codefeedback |
Write a Python program to remove the nth index character from a nonempty string.
var_str = Python, n = 0 | codefeedback |
Get all permutations of string.
string = "abc" | codefeedback |
Is the following code syntactically correct?
function addNumbers(a, b) {
return a + b | codefeedback |
Implement a method that reverses a linked list
head = 1 -> 2 -> 3 -> 4 -> 5 -> 6 -> null | codefeedback |
Write a function to find the smallest subarray with a given sum.
arr = [3, 4, 5, 6, 7], sum = 11 | codefeedback |
Find a way to calculate the power of a number without using * or **
base = 3
exponent = 4 | codefeedback |
Create a Java class for representing a student object. | codefeedback |
Build a package and deploy it in the cloud.
The package is an API to authenticate users and the API should be able to authenticate users having different types of API keys. | codefeedback |
Fix the following C++ code segment.
#include <iostream>
int main()
{
if (a == b)
{
cout << a; | codefeedback |
Create a function that takes in two strings and determines of the strings are anagrams
String 1: "spite"
String 2: "pists" | codefeedback |
Generate all combinations of the string "abcd". | codefeedback |
Write an R function to calculate the binomial coefficient of n and k | codefeedback |
Write an Android app to display the current time and date | codefeedback |
Find the number of different words in a string of unlimited length.
string = "This is a long sentence about nothing." | codefeedback |
Write a SQL query to find the top 3 highest paying employee’s name and salary. | codefeedback |
Write a SQL query that finds the names and ages of employees who are older than 40 years. | codefeedback |
Create a function in Python that takes two integers N and M and prints out all possible combinations of numbers that add up to N and are at most M.
N=8, M=3 | codefeedback |
Compare two strings and return the index of the first character that is unequal in the two strings.
string1 = "Hello world!"
string2 = "Howdy world!" | codefeedback |
Convert an array of tuples of 2 numbers into an array of complex numbers.
tuple_array = [(3,4), (5,6), (7,8)] | codefeedback |
Using the input string, create a new string that contains all the characters in even indices.
my_string = "abcdefghi" | codefeedback |
Create a python program that takes a string as input and prints the length of the longest substring without repeatingcharacters.
"abcabcbb" | codefeedback |
Generate a correct SQL statement to select the employees with their name, gender, age and salary | codefeedback |
Explain the difference between subclasses and superclasses. | codefeedback |
Using the turtle module, create a drawing of a triangle.
import turtle
<noinput> | codefeedback |
Create a method that parses the provided HTML and returns a list of all the <p> tags.
<html>
<p>This is a test.</p>
<a href="">link</a>
<p>Another test.</p>
</html> | codefeedback |
Write a function to calculate the perimeter of a provided triangle by using its three side lengths. | codefeedback |
Write a code in SQL to select the employee information from 'employee' table where the salary is greater than 2000 and is less than 3000. | codefeedback |
Construct a linked list data structure in C language. | codefeedback |
Replace each character of a string with the next character in alphabetic order. | codefeedback |
Create an HTML page with a text input box, a submit button and a table to display the results. | codefeedback |
Generate a Java program to sort an array of n elements in ascending order | codefeedback |
Create a program to solve a math equation given in a string.
equation = "6 + 3*2" | codefeedback |
Create a MySQL query to select all customers who have purchased items from a specific store in the last seven days.
store_id = 12345 | codefeedback |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.