instruction_seed
stringlengths
0
26.4k
source
stringclasses
4 values
Design a C program to print the phrase "Hello, World!" in reverse order, with each letter on a new line.
codefeedback
Write a function in JavaScript to extract the Kth highest digit from a given number. Number can be a positive or negative integer. Number = -3752 K = 4
codefeedback
Create an algorithm in pseudocode to find the maximum value in a multidimensional array. The array can have an arbitrary number of dimensions, and each dimension can have an arbitrary size. The maximum value should be found by comparing all elements in the array. The algorithm should have a time complexity of O(N), whe...
codefeedback
Compute the minimum of 10,000 given numbers using a JavaScript function. The function should have a time complexity of O(n) and a space complexity of O(1).
codefeedback
Generate a 20 digit random number using a JavaScript function
codefeedback
Create a SQL query which returns the products that have a price greater than 100, a quantity greater than 10, and belong to a category with at least 100 products.
codefeedback
Write a SQL query which returns the product name, the number of times it has been purchased, and the total revenue generated by each product.
codefeedback
Correct the following JavaScript code to print the first letter of the given string. Ensure that the solution uses a recursive function to find the first letter, and the code should have a time complexity of O(1). Additionally, the solution should not use any built-in JavaScript functions or methods. let str = "Hello ...
codefeedback
Create a SQL table which has 4 columns: id, name, price, and quantity. The quantity column should only accept positive integers.
codefeedback
Construct a SELECT query in MySQL to find all records where the age is greater than 18 and the student has scored more than 90 in their math exam. Table: Student Note: You can assume that the math exam scores are stored in a separate column in the Student table.
codefeedback
Write a function in JavaScript to delete duplicate characters from a string while maintaining the original order of the characters. String: "google"
codefeedback
Make an HTML table of the given integers and highlight the cells that are prime numbers.
codefeedback
Debug the given Python code and make sure that it runs without errors. The function should also return the sum of the two input numbers, rounded to the nearest integer. Additionally, the function should only accept positive integer inputs.
codefeedback
Create an algorithm in Java to calculate the sum of all elements of an array. Your algorithm should not use any loop or recursion.
codefeedback
Write a CSS rule that adds a border to the first element of a list, but does not affect any subsequent elements.
codefeedback
Write a program that calculates the sum of all the even numbers in the following array and displays the result in the console. let arr = [5, 8, 15, 7];
codefeedback
Construct a function in C++ to check if two numbers are co-prime or not. The function should also find the greatest common divisor (GCD) of the two numbers and return it. The function should take into account the following additional constraints: - The function should not use any built-in C++ library functions or algor...
codefeedback
Modify the Python code below to solve the following error: "TypeError: 'str' object is not callable". """ def greet(name): print('Hello', name()) greet('John') """ #Updated Test#
codefeedback
Render a responsive webpage with three columns using just HTML and CSS. The webpage should have a fixed header and footer, with each column containing a minimum of 5 elements. The columns should collapse into a single column layout when viewed on a mobile device.
codefeedback
Explain the purpose of the ``await`` operator in an asynchronous JavaScript function, and provide an example demonstrating its usage with Promise chaining and error handling.
codefeedback
Create a method in JavaScript to convert a string to camel case, but without using any built-in string manipulation methods or regular expressions.
codefeedback
Implement a neural network with at least 3 hidden layers and 100 neurons each that classifies an MNIST digit into one of the 10 classes. The network should have a dropout layer with a dropout rate of 0.5. Additionally, the network should use the Adam optimizer with a learning rate of 0.001 and the categorical cross-ent...
codefeedback
For a given two dimensional array, convert it into a valid JSON object. However, the array may contain both numeric and string values. Ensure that all the values are correctly formatted in the resulting JSON object. Input array: [[1,"two",3], [4,5,6], ["seven",8,9]]
codefeedback
Convert a given string in the form of a camelCase notation to snake_case notation while also ensuring that all snake_case words start with a lowercase letter. The converted string should also have an underscore (_) before each uppercase letter in the original string. camelCaseString
codefeedback
Write a SQL query to find all customers who did not place an order in the last 3 months and have a total order amount greater than $1000.
codefeedback
Develop a function that takes a nested dictionary and returns a list of keys and values, where the values are converted to their corresponding data types. For example, for the input {"Name": "John", "Age": "45"}, the output should be [("Name", str), ("Age", int)].
codefeedback
Generate a Python program that creates a list of even numbers from 1 to 10.
codefeedback
Design a system that can take an integer list as its input and return a sorted list. However, you are now required to implement the sorting algorithm yourself, rather than using a built-in sorting function or library. Additionally, the time complexity of your sorting algorithm should be O(n log n), and the space comple...
codefeedback
Calculate the factorial of a positive integer in C, but without using any loop constructs (such as for, while, or do-while).
codefeedback
Write a Rust program that prints the factorial of the given number. The number should be taken as input from the user. Example: Input: 5 Output: 120
codefeedback
Convert the following JSON string into an array, ensuring that the array elements are sorted in alphabetical order based on the keys.{"key1": "value1", "key2": "value2"}
codefeedback
Write a Bash script to print the largest number in an array. The script should also print the index position of the largest number in the array. Additionally, you should implement a function to sort the array in descending order before finding the largest number. The array should contain only positive integers. array=(...
codefeedback
Design a class in Java that stores information about a person's name, age, phone number, and address. Implement the following functionalities: 1. Provide a method to update the person's name. 2. Provide a method to update the person's age. 3. Provide a method to update the person's phone number. 4. Provide a method to...
codefeedback
Explain the purpose and implementation of the media query and provide an example of a complex media query that targets specific devices with different screen sizes, orientations, and resolutions.
codefeedback
Design a class in Java to represent a bank account that includes the following functionalities: 1. Allow the user to deposit a specific amount of money into the account. 2. Allow the user to withdraw a specific amount of money from the account. 3. Keep track of the account balance and provide a method to retrieve it. ...
codefeedback
Write a query in MongoDB that selects all documents in a given collection where the value of a specific field is greater than a given number.
codefeedback
Write a function to sort a list of numbers using merge sort, but you are not allowed to use any built-in sorting functions or libraries. You should also implement the merge sort algorithm recursively. myList = [4, 8, 2, 3, 1].
codefeedback
Parse the following XML code and print all the "name" fields of employees whose age is between 30 and 40.
codefeedback
Create a function that takes in a list of strings, representing the names of relatives, and returns a new list containing only the names that have more than 3 vowels in them. The function should ignore case when counting vowels. The output list should be sorted in alphabetical order. You are not allowed to use any buil...
codefeedback
Unpack a given list of tuples and calculate the average age of the people in the tuples. The tuples should contain at least 5 elements and the names should be unique. Each person's age should be between 18 and 60.
codefeedback
Design a class for representing a triangle with its 3 sides, where the sides must be positive integers and the triangle must satisfy the Pythagorean theorem.
codefeedback
Write a function in JavaScript to validate a credit card number according to the Luhn algorithm, while also checking if the card belongs to a specific credit card company. The function should take the credit card number as a parameter and return true if the card is valid and belongs to the specified company, otherwise ...
codefeedback
Create a web crawler to extract all the links within a given web page, including all its subpages, up to a certain depth level. url = "https://www.example.com" depth = 2 The web crawler should be able to handle websites with a large number of subpages and extract all the links within those subpages as well. The depth ...
codefeedback
Create an HTML table using the dataset provided. The table should have the following columns: "Name" and "Age". Each row of the table should correspond to an entry in the dataset. The table should also have a header row that displays the column names. The table should be styled with CSS to have alternating row colors a...
codefeedback
Generate a valid HTML markup from the given JSON data, ensuring that the generated HTML includes the name, city, and state information. Additionally, the HTML markup should have a background color of "#F5F5F5" and a font size of 16 pixels.
codefeedback
Design a class in Java which allows the user to set the value of an Attribute, but also includes the following functionalities: 1. The class should have a constructor that initializes the attribute with a default value. 2. The attribute should have a maximum and minimum limit, and any value set outside this range shou...
codefeedback
Determine the data type for the given value. value: "hello" Requirement: The solution must use regular expressions to determine the data type.
codefeedback
Change the given code so that the variable is incremented only if the condition returns true. The condition should now be the result of a complex mathematical calculation that involves multiple variables and operations.
codefeedback
Create a Python function to generate all prime numbers less than a given number, while also ensuring that the function can handle inputs up to 10^6 efficiently.
codefeedback
Write a code snippet in Javascript to print out the alphabetical characters in a string, ignoring any duplicate characters and sorting them in descending order. var myString = "Taichi Tamura"
codefeedback
Write a function that takes a list of integers as input and returns a new list with all prime numbers removed. Input: [4, 8, 15, 16, 23, 42, 7, 9, 11] Output: [4, 8, 15, 16, 42, 9]
codefeedback
Given a list of n strings, find the k most frequent words in the list. If multiple words have the same frequency, return them in lexicographical order. #Example# Input: words = ['apple', 'mango', 'banana', 'apple', 'orange'] k = 2 Output: ['apple', 'banana']
codefeedback
Write a validation code to verify if a given string is an integer, considering the following constraints: - The string can be preceded by an optional positive or negative sign. - The string can contain leading and trailing whitespaces. - The string can only consist of digits. - The string cannot exceed a length of 10 c...
codefeedback
Print out the Fibonacci sequence up to 1 million in Java.
codefeedback
Create a program in Java that takes in 2 numbers and swaps them. However, you are not allowed to use a temporary variable for the swap operation. int a = 5; int b = 3;
codefeedback
Print all the prime numbers between a given range in Python. start = 5 end = 100
codefeedback
What is the output from this snippet of JavaScript code? var a = 5; var b = 10; a = b; b = a + 1; console.log(a, b);
codefeedback
Create a program in JavaScript that can detect a palindrome. The program should ignore any punctuation marks and white spaces in the string. The program should also be case-insensitive when determining if a word is a palindrome. Additionally, the program should handle multi-word palindromes, where a phrase or sentence ...
codefeedback
Write a Lambda function to filter out the prime numbers from a given list of integers. The function should return a new list containing only the prime numbers. Input: [2, 3, 4, 5, 6, 7, 8, 9, 10] Output: [2, 3, 5, 7]
codefeedback
Develop an efficient algorithm to find the maximum number of overlapping intervals in a given set of intervals, where each interval is represented by a pair of integers denoting its start and end points. The algorithm should consider intervals that partially overlap as well. The input intervals may contain duplicates a...
codefeedback
Change the font size of a <div> element to 16 pixels using CSS, but only when the mouse hovers over the element. <div>This is a div element</div>
codefeedback
What is the correct code for looping through a list of elements in Python, while excluding any element that is a multiple of 3, and printing the square of each element?
codefeedback
Generate a C program to generate a multiplication table up to a given number, but instead of printing the table in the traditional format, print it in a diagonal format. Example output for n = 5: 1 4 9 16 25 36 49 64 81 100 121 144 169 196 225
codefeedback
Create a variable in Java for storing a user's first name and ensure that the first name has a minimum length of 3 characters and a maximum length of 20 characters.
codefeedback
Determine the largest number in a list of integers using C. The list may contain duplicate numbers and the size of the list is greater than or equal to 10. You are not allowed to use any built-in functions or libraries. Implement your own algorithm to find the largest number. int list[] = {3, -2, 0, 7, 1, 4, 7, -1, 5, ...
codefeedback
Edit the following code to produce a 4x4 multiplication table for the prime numbers between 10 and
codefeedback
Write a C++ program that calculates the volume of a cylinder given the radius and height.
codefeedback
Build an algorithm to compare two strings and report whether they are identical or not, without using any built-in string comparison functions or libraries. string1 = "hello"; string2 = "world";
codefeedback
Convert a decimal number to binary using bitwise operations. Implement a function that takes an integer as input and returns its binary representation as a string. num = 12345 Example: Input: 12345 Output: "11000000111001" Note: You are not allowed to use any built-in or library functions to convert the number.
codefeedback
Create a SQL query that fetches all customers from a table named 'customers' whose name starts with 'John' and have made at least 5 purchases.
codefeedback
Create an SQL query to return the customer name, total amount spent on all orders in the past week, and the number of orders placed by each customer.
codefeedback
Design an algorithm to search for the longest string in a list and return its length. list = ["apples", "bananas", "kiwis"] #Erroneous Code# Design an algorithm to search for the longest string in a list and return its index. list = ["apples", "bananas", "kiwis"] #Explanation# The original test was already quite stra...
codefeedback
Given an array of integers, find the second largest number without using any built-in sorting functions or additional data structures. Your solution should have a time complexity of O(n) and a space complexity of O(1). Example: Input: [10, 20, 30, 40, 50] Output: 40 Note: In the example above, the second largest numb...
codefeedback
Combine the following two lists into a dictionary in Python, but only include elements from list1 that have corresponding elements in list2. list1 = ["a", "b", "c", "d", "e"] list2 = [1, 2, 3]
codefeedback
Create a recursive Python function to generate the Fibonacci series up to the n-th term. The function should have a time complexity of O(2^n).
codefeedback
Create a hash table in C with 5 elements that can store string keys and integer values. Implement a collision resolution strategy using separate chaining. Additionally, the hash table should support resizing when the load factor exceeds 0.75.
codefeedback
Create a program that converts a string to a URL friendly slug, while also handling various edge cases and optimizing the solution for performance. # Additional Requirements # 1. The program should handle special characters and replace them with their corresponding URL encoded values. 2. The program should handle lead...
codefeedback
Create a function that takes a string as input and returns a new string that is the reversed version of the original string. However, the function should also remove any duplicate characters in the reversed string.
codefeedback
Create a function that takes two numbers as input and returns their greatest common divisor (GCD) using the Euclidean algorithm in Python. The Euclidean algorithm is an efficient method for finding the GCD of two numbers. To increase the difficulty, consider adding the following: 1. Randomized inputs: Instead of fixe...
codefeedback
Create a function to input a number and prints out its prime factorization, but you are not allowed to use any built-in prime factorization functions or libraries.
codefeedback
Create a function to accept an array of integers and return an array with the corresponding squares of each element, but without using any built-in functions or operators for multiplication or exponentiation. arr = [1, 2, 3, 4]
codefeedback
Code a Python script that converts temperatures in celsius to fahrenheit. The script should also include error handling to ensure that the user enters a valid temperature value. Additionally, the script should provide an option for the user to convert the temperature in reverse, from fahrenheit to celsius.
codefeedback
Code a script that prints out the first n elements of the Fibonacci sequence, where n is a prime number.
codefeedback
Write a piece of code to print out the first n Fibonacci numbers in Python, where n is a positive integer entered by the user. To solve this problem, you can follow these steps: 1. Prompt the user to enter a positive integer value for n. 2. Validate the input to ensure it is a positive integer. If the input is not va...
codefeedback
Create a program to convert a binary number to its decimal equivalent. Additionally, implement error handling to validate that the user input is a valid binary number.
codefeedback
Generate a Python program to calculate the total number of vowels in a given string. However, this time, you need to consider both uppercase and lowercase vowels. Additionally, you need to exclude any vowels that occur as part of a consonant cluster (i.e., a group of consonants with no vowels in between).
codefeedback
Suggest an efficient algorithm to select the last element of a given list in Python, with a time complexity of O(1).
codefeedback
Suggest a Pandas DataFrame command to remove element duplicates from a given dataframe, while also keeping track of the original index positions of the duplicates.
codefeedback
Design a class in Java to represent a rectangle and include methods to calculate and return its perimeter, area, and diagonal length. #Additional Instructions# 1. The class should have private instance variables for the length and width of the rectangle. 2. Include getter and setter methods for the length and width v...
codefeedback
Create a class in Python to represent a bank account and add methods to display, withdraw, deposit and transfer money. The bank account has the following details: - Customer Name: John Doe - Account Number: 12345 - Balance: $1000 The bank account should also have the following features: - Enable interest calculation: ...
codefeedback
Sort a given list of numbers from smallest to largest with Python. However, you are not allowed to use any built-in sorting functions or libraries. You must implement your own sorting algorithm. [12,3,7,9,1]
codefeedback
Create a website for the company ACME with all the following pages: Home, About Us, Contact Us, FAQ, Privacy Policy, and Product Listings. The website should have a login functionality and allow users to add products to their cart. The cart should be persisted across sessions. Additionally, implement a search functiona...
codefeedback
Write a C++ function that takes in a string as input and replaces all occurrences of a vowel with the character "X". The function should return the modified string. Assume that the string only contains lowercase alphabets and does not contain any special characters or spaces. The time complexity of your solution shoul...
codefeedback
Generate 10 random strings of 5 characters in length with JavaScript. Each string must contain at least one uppercase letter, one lowercase letter, one number, and one special character.
codefeedback
Create a web page with two text fields for username and password. Validate the username and password inputs against a predefined list of usernames and passwords stored in a database. If the username and password are valid, display a welcome message; otherwise, display an error message. Implement secure password hashing...
codefeedback
Use a regular expression to replace URLs with "URL" in a given text in Python. However, ensure that the regular expression does not replace URLs that are within HTML anchor tags. This is a text with a link <a href="http://example.com">http://example.com</a>
codefeedback
Create a K Nearest Neighbor (KNN) classifier in R that uses the Euclidean distance metric to measure similarity between data points.
codefeedback
Write a SQL query to display owners and their pet names. Also, include the number of pets each owner has. Table: Owners +------------+---------+ | owner_name | pet_name| +------------+---------+ | John | Buggs | | John | Max | | John | Coco | | David | Bella | | David | Lily |...
codefeedback
Write a Bash script that finds the factorial of a given number, but now ensure that the script handles negative input by displaying an error message.
codefeedback
Implement a breadth-first search algorithm in Python with a space complexity of O(n) and a time complexity of O(V+E), where V is the number of vertices and E is the number of edges in the graph. Additionally, ensure that the algorithm can handle a directed graph and return the shortest path between two given vertices.
codefeedback