instruction_seed stringlengths 0 26.4k | source stringclasses 4
values |
|---|---|
Reverse a string in place
word = 'hello' | codefeedback |
write a function that takes two integers and returns their product. | codefeedback |
Write an algorithm to detect the longest common subsequence of two given strings.
str1 = "ABCGDH", str2 = "ADGH" | codefeedback |
Implement a backtracking algorithm to solve a sudoku puzzle.
[
[7, 8, 0, 4, 0, 0, 1, 2, 0],
[6, 0, 0, 0, 7, 5, 0, 0, 9],
[0, 0, 0, 6, 0, 1, 0, 7, 8],
[0, 0, 7, 0, 4, 0, 2, 6, 0],
[0, 0, 1, 0, 5, 0, 9, 3, 0],
[9, 0, 4, 0, 6, 0, 0, 0, 5],
[0, 7, 0, 3, 0, 0, 0, 1, 2],
[1, 2, 0, 0, 0, 7, 4, ... | codefeedback |
How many trailing zeros are in the factorial of the number "n"?
n = 20 | codefeedback |
What are the main differences between a stack and a queue? | codefeedback |
Explain the process of quicksort. | codefeedback |
Generate the html markup for a table that contains the given data.
Roll No | Name | City
101 | John | London
102 | Mark | Paris
103 | Luis | Singapore | codefeedback |
Rewrite the given array of numbers into a binary tree.
[3, 1, 4, 7, 2, 5] | codefeedback |
Make the following code more efficient
def remove_dups(mylist):
newlist = []
for item in mylist:
if not item in newlist:
newlist.append(item)
return newlist | codefeedback |
Develop a full-stack web application to display a list of items. | codefeedback |
Create an Angular app with a login page and registration page. | codefeedback |
Create a class called “Car” in Java with the following attributes and methods. | codefeedback |
Create a query that returns the top 5 cities with the highest population. | codefeedback |
Create a function to calculate the total cost of a shopping cart, given the price and the quantity of each item.
Item Price Quantity
Apple 2$ 2
Orange 3$ 5
Banana 1$ 1 | codefeedback |
Create an algorithm to implement a binary search. | codefeedback |
Train a recursive neural network to classify whether a sentence is positive or negative. | codefeedback |
Make a POST request to the same server and download the response content | codefeedback |
Design a Python class to represent geometric shapes. | codefeedback |
Convert this given number in base 10 to base 2
34 | codefeedback |
Define an F# array and initialize it with even numbers from 0 to 10 | codefeedback |
Change the provided dataset into a 3-dimensional tensor, in order to feed it into a Convolutional Neural Network model.
Dataset containing 10,000 grayscale images of size 32x32 | codefeedback |
Write code to implement the Binary Search algorithm in Python. | codefeedback |
Remove duplicates from the given list and return a new list.
my_list = [2, 3, 4, 2, 3, 5] | codefeedback |
Compute the entropy of a given probability distribution.
Distribution: [2/9, 3/9, 4/9] | codefeedback |
Construct the following JSON object. | codefeedback |
Create a Python function to sort a list of strings based on a given alphabetical order.
alphabet = 'bdhajfz', strings = ['bad', 'hfja', 'abd', 'zaj'] | codefeedback |
You need to create a Python function to detect if a given number is prime or not. | codefeedback |
Construct a function that prints the first n terms in a Fibonacci sequence. | codefeedback |
Given a string, find the longest palindrome within it.
string = "ananabay" | codefeedback |
Write a python program to get all possible permutations of a given set of characters. | codefeedback |
Create a function that takes a specific input and produces a specific output using any mathematical operators. | codefeedback |
Create a function that generates a series of Fibonacci numbers up to a certain number of items. | codefeedback |
Write an algorithm to find the smallest missing positive number from a given list of integers.
[3, 4, -10, -2, 9, 8, 1] | codefeedback |
Create an HTML website with navigation, logo and footer.
<ninput> | codefeedback |
Write an algorithm to insert a new element in a given sorted array. | codefeedback |
Analyze this text using spaCy.
Text: Modern technologies are revolutionizing the way we live and work. | codefeedback |
Implement a code that checks if a given word is palindrome.
Word: malayalam | codefeedback |
Write a code which takes two strings and prints its longest common subsequence.
String1: "ABCDGH"
String2: "AEDFHR" | codefeedback |
Compute the maximum subarray sum for the given array.
Array: [-2,1,-3,4,-1,2,1,-5,4] | codefeedback |
Create a code which prints a multiplication table of given size.
Size: 4 | codefeedback |
Write a regular expression to match the valid hex color code. | codefeedback |
Find all the prime factors of a given integer.
100 | codefeedback |
Create a custom min-heap data structure in Python. | codefeedback |
Suggest an algorithm for finding the maximum sum for all subarrays.
arr = [2, 3, -5, 4] | codefeedback |
Write an SQL query to find the maximum number of orders for each state.
Orders (id, customer_id, state, order_num) | codefeedback |
How can you fill a 2D array with zeros? | codefeedback |
Replace all vowels with 'x' in a given string.
myString = "Python Programmer" | codefeedback |
Select the last two elements from a given list
mylist = [1,2,3,4,5] | codefeedback |
Write a JavaScript program to group an array of objects based on a property and sum up the values of the grouped objects.
arr = [
{name: 'John', salary: 100},
{name: 'Heather', salary: 200},
{name: 'John', salary: 300},
{name: 'Heather', salary: 400}
] | codefeedback |
What is the difference between a static method and an instance method in Python? | codefeedback |
How can we convert a sql query into pandas code? | codefeedback |
Rewrite the code block in an optimized way.
nums = [1, 2, 3, 4, 5, 6]
new_nums = []
for num in nums:
new_nums.append(num + 1) | codefeedback |
Given an acute angled triangle, write a function to compute its area using Heron's formula. | codefeedback |
Create a function for printing each letter of a string on a separate line.
str = "Hello World" | codefeedback |
Write a Python program that prints all numbers from 1 to 100 that are divisible by both 5 and 7. | codefeedback |
Design a text-based game in C++ in which the player can move around the game world. | codefeedback |
Fix the bug in the following code by modifying the function is_star_jumping_high_enough:
def is_star_jumping_high_enough(star_height):
"""return true if star height is greater than 5"""
if star_height < 5:
return True | codefeedback |
Compose a JavaScript code to sum all odd numbers in the range
From 1 to 10, | codefeedback |
Construct a regular expression to match a given string
String: "Hello World!" | codefeedback |
Create a sorting algorithm to quickly sort an array of integers
Array: [5, 4, 6, 7, 1] | codefeedback |
Write a Java method that takes in a string and returns an array containing all the possible permutations of this string. | codefeedback |
Rewrite the following piece of code in Python.
for (i = 0; i < 10; i++)
if (i % 2 == 0)
printf("%d", i); | codefeedback |
Write a function that takes a string and a key as parameters and encrypts the string with the key. | codefeedback |
How would you differentiate a local variable from a global variable? | codefeedback |
Write a code to traverse a given tree in breadth-first order. | codefeedback |
Translate the following sentence into its Python equivalent.
"If the number is greater than 10, print 'Success'." | codefeedback |
Implement a recursive solution to calculate the nth Fibonacci number. | codefeedback |
Write a Python function to find the largest prime factor of a given integer. | codefeedback |
What would you change in the following function to sort a list of numbers in increasing order?
let arr = [ 4, 2, 5, 1, 3 ]
function bubbleSort(arr) {
for (let i = 0; i < arr.length; i++) {
for (let j = 0; j < arr.length - i - 1; j++) {
if (arr[j] > arr[j + 1]) {
let temp = arr[j];
... | codefeedback |
Generate a regex to match any valid IPv4 address. | codefeedback |
What are the main components of an object oriented programming language? | codefeedback |
Describe a greedy algorithm | codefeedback |
Write a SQL query to delete data from a table named 'customers'. | codefeedback |
Write an algorithm that prints the first 10 Fibonacci numbers in descending order. | codefeedback |
Construct an HTML table with two columns, "First Name" and "Last Name", and 5 rows of example data. | codefeedback |
Create a SQL query that returns the name, age and salary for all employees whose age is greater than 40. | codefeedback |
Create a function that takes as argument the number of elements and return a list containing the Fibonacci sequence up to that number.
n = 10 | codefeedback |
Execute a SQL query to find the 2 most populous countries in the world. | codefeedback |
Convert the following infix expression to postfix notation.
A + B * C | codefeedback |
Create a function to calculate the binomial coefficient for two integers.
n = 5
r = 3 | codefeedback |
Compute the number of ways to make a change of N with coins of given denominations.
N = 4; Coins = {1,2,3} | codefeedback |
Develop an algorithm to find the maximum consecutive repeating character in a given string.
"aaaaabcdddddefgggg" | codefeedback |
Create an algorithm in Python that converts a given number from base 10 to binary.
8 | codefeedback |
Create a function in Java that finds the difference between the largest and the smallest elements in a given array.
[1, 5, 10, 20] | codefeedback |
Write a loop statement to delete all even numbers from the given array.
[1, 2, 3, 4, 5] | codefeedback |
Find the index of the maximum value.
[3, 5, 9, 11, 18, 23, 27] | codefeedback |
Change this sentence into a valid mathematical expression.
Four minus five | codefeedback |
Create a regular expression that matches any URL. | codefeedback |
Write an array sorting function that sorts the array in ascending order.
[3, 1, 9, 5, 4] | codefeedback |
Given a binary tree, write a method to compute the maximum path sum.
10
/ \
2 10
/ \ / \
20 1 -25 6 | codefeedback |
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.
Input: 1->2->3->4->5->NULL, k = 2 | codefeedback |
Build a PHP class that handles user data for a website. | codefeedback |
Write a class in Java that prints out the nth number of the Fibonacci sequence using recursion.
6 | codefeedback |
Write a code snippet to read characters from a given string until a whitespace is encountered | codefeedback |
Design an algorithm to search for a particular node in a binary tree using breadth-first search. | codefeedback |
Develop an algorithm to traverse a linked list in a reverse order. | codefeedback |
Compose a Java program to print a given pattern on the screen.
N = 5 | codefeedback |
Create a Java program to list out all prime numbers between 1 and n.
n = 20 | codefeedback |
Construct a SQL query to find the top 3 highest scored games. | codefeedback |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.