instruction_seed stringlengths 0 26.4k | source stringclasses 4
values |
|---|---|
Create a JSON object with three key-value pairs. | codefeedback |
Compose a function named average_list which takes a list of numbers as its argument and computes the average. | codefeedback |
Generate a snippet of code to extract all the URLs from the given string.
This string contains some urls such as https://www.google.com and https://www.facebook.com. | codefeedback |
Write a code to convert a given spredsheet in csv format to json format. | codefeedback |
Design a program to find the longest element in the given list.
[10, 100, 200, 500, 400] | codefeedback |
Write a function to print all prime numbers between two given numbers. | codefeedback |
Generate a regular expression to match a valid email address. | codefeedback |
How to delete a particular row in an SQLite database table? | codefeedback |
Create a class in Java named Puppy that has two instance variables, age and name and two methods, bark and sleep. | codefeedback |
Implement a function that finds the maximum element in a given array.
arr = [45, 7, 0, 82, 23] | codefeedback |
Rewrite the following code using ternary operator.
num1 = 5
num2 = 10
if num1 < num2:
print("num1 is smaller than num2")
else:
print("num1 is greater than or equal to num2") | codefeedback |
Create a quick-sort algorithm in Python. | codefeedback |
Develop an algorithm to find the value of n where n is the index of the Fibonacci sequence. | codefeedback |
Write a SQL query to find all the users in a database with age greater than 25. | codefeedback |
Write a code to print the current date and time in ISO format. | codefeedback |
Write a code to connect to a remote database.
username: john
password: john123
IP: 100.10.0.10 | codefeedback |
Write a code to access the nth element of a linked list. | codefeedback |
Write a code to add two linked lists of different sizes.
list1 = [2->4->3]
list2 = [5->6->4->1] | codefeedback |
Generate a dictionary of 10 key-value pairs, where the key is a string and the values are random numbers from 1 to 100. | codefeedback |
Write an SQL query to calculate the difference between the total salaries of male and female employees in a table. | codefeedback |
You are given a matrix of m rows and n columns. Write a function that calculates the transpose of the given matrix.
matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] | codefeedback |
You are given a list of numbers. Create a function that returns a new list with duplicates removed
list_of_numbers = [3, 6, 5, 5, 7, 6, 3] | codefeedback |
In a given string, create a function that returns the longest consecutive sequence of characters.
my_string = “abccdeefghj" | codefeedback |
Write a function that takes in a string and returns a list of all the words that have more than 5 characters | codefeedback |
Convert the following binary number to a decimal number.
Binary Number: 10011 | codefeedback |
What is the largest prime factor of the number 885? | codefeedback |
Create a program to convert the input sentence to Pig Latin.
I am a computer programmer | codefeedback |
Write a function that sorts the given list of numbers in descending order
[1, 2, 3, 5, 8, 10] | codefeedback |
Create a program to check if a given string is a palindrome
"racecar" | codefeedback |
Classify the following sentence as positive or negative sentiment.
This is the worst experience ever. | codefeedback |
Write a code to compare two lists and find the common elements.
list1 = [3, 6, 9, 12]
list2 = [2, 4, 5, 6, 8, 9] | codefeedback |
Write a function to determine if two strings are anagrams of each other | codefeedback |
Write a JavaScript code to calculate the factorial of a number | codefeedback |
Estimate the time complexity of the following algorithm.
for i in range(n):
for j in range(n):
print(i + j) | codefeedback |
Using the numpy library, create a 3x3 Identity Matrix. | codefeedback |
Given a binary tree, write a code snippet to list all of its descendant leafs. | codefeedback |
Given a string, write a function to remove all the duplicate characters.
string = "apple" | codefeedback |
classify the following sentence using a sentiment analysis model.
The movie is awesome. | codefeedback |
convert all words in a sentence to camelCase
The quick brown fox jumps over the lazy dog | codefeedback |
Implement a function to extract the last two words from a string of words | codefeedback |
Write code to flatten a nested list | codefeedback |
Generate pseudocode for a matrix multiplication algorithm. | codefeedback |
Generate a data structure that can efficiently store an array of words | codefeedback |
Create a function to find the position of a substring in a string | codefeedback |
Write a JavaScript code to valid a password based on the following rules: | codefeedback |
How would you determine if a given number is a prime number? | codefeedback |
Normalize a given array such that it adds up to 1.
[3, 0, 9, 5] | codefeedback |
Write a code to check whether a given year is a leap year or not | codefeedback |
Write code to find the longest substring of unique characters in a given string.
string = 'abcabcbb' | codefeedback |
Write code to find the most frequent item in an array
arr = [1, 4, 6, 8, 9, 1, 4, 6] | codefeedback |
Create a program to display all prime numbers between a given range.
a, b = 2, 8 | codefeedback |
Write a code to remove the oldest elements from a list until the list contains at most 10 elements.
list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] | codefeedback |
Explain the concept of object-oriented programming. | codefeedback |
Write a Javascript code to check if the given number is a prime number. | codefeedback |
Write a SQL query to select the top 3 highest salaries in a employees table. | codefeedback |
What is data transformation and how is it used? | codefeedback |
Create a JavaScript function that takes an array of numbers and returns the median value from the array. | codefeedback |
Write a C++ code to find the longest common substring in two strings. | codefeedback |
Write an algorithm to perform binary search on a sorted array. | codefeedback |
Given a string, write a Python program to find the first non-repeating character in it.
input_str = "aaaaabbbbccc" | codefeedback |
Construct a regular expression to extract all words from a given string that start with a specific letter.
input_str = "The quick brown fox jumped over the lazy dog" | codefeedback |
Write a C++ function to find the maximum element in an array. | codefeedback |
Given a string s, write a function to check if the string is a palindrome.
s = "A man, a plan, a canal: Panama!" | codefeedback |
Edit the Java code to filter out the persons whose age is less than 18.
List<Person> persons = new ArrayList<>();
for (Person person : persons) {
System.out.println(person.getName());
} | codefeedback |
You need to find the largest subset of an array that sums up to a given value.
arr = [1, 2, 3, 4, 5], target = 8 | codefeedback |
Generate an array with the first 10 even numbers | codefeedback |
How do you merge two sorted arrays in O(n) time? | codefeedback |
Compare and contrast two sorting algorithms: Bubble sort and Quick sort. | codefeedback |
Convert the given binary string to its corresponding decimal number.
10111101 | codefeedback |
Write a Python code snippet to print the pyramid structure with the given number of lines.
4 | codefeedback |
Create a regex expression that captures a valid URL. | codefeedback |
Write a C++ class to represent a date. | codefeedback |
Create a list of two-word phrases using each of the four words ('apple', 'bear', 'cat', 'dog'). | codefeedback |
Find the largest number from the given list of numbers.
[7, 9, 11, 5] | codefeedback |
Write a Python script to count the number of occurances of each character in a given string.
string = "Mississippi" | codefeedback |
Describe how to debug a C++ program using GDB. | codefeedback |
Write code in Java to create a linked list. | codefeedback |
Describe the steps of creating an application using the Flask framework. | codefeedback |
Using Python, create a list containing the first 20 prime numbers. | codefeedback |
Implement a Java program for finding the index of an element in a sorted array. | codefeedback |
Improve the following code in order to create a balanced binary search tree.
Node insert(int x, Node root)
{
if (root == NULL) {
root = new Node;
root->key = x;
root->left = root->right = NULL;
}
else if (x < root->key)
root->left = insert(x, root->left);
else... | codefeedback |
Write a SQL query to join two tables on a specified conditions.
Table 1:
id name age
1 a 15
2 b 18
3 c 20
Table 2:
id class marks
1 10 80
2 10 75
3 11 70 | codefeedback |
Write a function in Python to calculate the value of "e" to 4 decimal places. | codefeedback |
Write a JavaScript code to check if a string is a valid email address. | codefeedback |
Write a Python code to calculate the sum of natural numbers up to n. | codefeedback |
Write a code to find the maximum subarray sum in an array using dynamic programming. | codefeedback |
Write a Python program to print out the Fibonacci sequence up to 20 numbers | codefeedback |
Design a function to remove duplicates from an array | codefeedback |
Create a program to generate an XOR linked list. | codefeedback |
Create a function to generate the nth term in the Fibonacci sequence.
n = 3 | codefeedback |
Write a function in JavaScript that takes an integer n and returns the nth Fibonacci number. | codefeedback |
Given the following array of dictionaries, write a function in Python to find and return the longest common prefix in the keys of dictionaries.
arr_of_dictionaries = [
{
"name": "John Doe",
"country": "United States"
},
{
"name": "Jane Doe",
"state": "New York"
}
] | codefeedback |
Write a function in Java that takes a string consisting of brackets and output true if the brackets are properly nested, else output false. | codefeedback |
Find the power of a number using an iterative approach in Java. | codefeedback |
Create a code that sorts element in an array. | codefeedback |
Using an object-oriented programming language, create a class that has two methods - one to calculate the area of a circle and another to calculate the circumference. | codefeedback |
Concisely describe how a Linked List works. | codefeedback |
Create a binary search tree in JavaScript. | codefeedback |
Edit the above PHP function so that it also checks if a given number is prime. | codefeedback |
Modify the function to also remove all whitespace from the string. | codefeedback |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.