instruction_seed
stringlengths
0
26.4k
source
stringclasses
4 values
Find the maximum of three integers without using any comparison operator or any built-in functions.
codefeedback
Create a SQL query to join two tables with the condition that the result should include all rows from the first table, even if there is no match in the second table. Additionally, the query should only return rows where the name column in Table1 starts with the letter 'A'. Both tables should be sorted in descending ord...
codefeedback
Build a website with HTML and CSS containing a header section, a main section, and a footer section. The header section should have a logo image and a navigation menu with at least three links. The main section should have a heading, two paragraphs, and a button that redirects to another page when clicked. The footer s...
codefeedback
Output the sum of the first n numbers using recursion.
codefeedback
Construct an algorithm that finds the minimum element in a nested array of values. The nested array can have an arbitrary number of levels, and each level can have an arbitrary number of elements. The minimum element can be any non-negative integer. For example: [5, [4, 11, [7, 12], 55], 3] The algorithm should be ab...
codefeedback
Create a SELECT query in MySQL to find the records in a given table that satisfy the following conditions: - The order has a quantity greater than
codefeedback
Create an Angular component which has a text field and prints the user input when the user clicks a button. Additionally, the component should display a character count of the user input in real-time, updating as the user types or deletes characters. The component should also include validation to ensure that the user ...
codefeedback
Concatenate two lists in Python without using the "+" operator or the "extend" method. list1 = [1,2,3,4] list2 = [5,6,7,8]
codefeedback
Write a MySQL query to select all the rows from the table 'employees' where the employee name starts with the letter 'A' and their age is greater than 30.
codefeedback
Define a function in Python that takes an integer and returns "positive" if it is a positive even number, "negative" if it is a negative odd number, "zero" if the integer is 0, and "unknown" for all other cases.
codefeedback
Write a function in C# for sorting an array in descending order (using an appropriate sorting algorithm).
codefeedback
You are given a 2-dimensional array of positive integers. Write a function in Python to find the sum of each row, where the sum of each row should be a prime number. If a row does not have a prime sum, ignore that row and do not include it in the final result. Return a list of the sums of each row that satisfy the prim...
codefeedback
Write a SQL query to assess the average order value in the past two weeks for customers who have made at least 5 orders.
codefeedback
Describe the algorithm and time complexity of selection sort and explain how it can be optimized using a min-heap data structure.
codefeedback
Create a program to convert all characters of a given string to their ASCII values and then sum them up.
codefeedback
Write an SQL query to retrieve all the columns and the total count of each column record from a table, excluding any records that have a null value in any column.
codefeedback
Implement a C++ program to display prime numbers between two given numbers, where the first number must be smaller than the second number. The program should also handle cases where the input numbers are negative.
codefeedback
Write a JavaScript code to compare two arrays and check whether they are exactly same or not. The arrays can contain elements of any data type and can have nested arrays as well. The code should handle cases where the arrays have different lengths or the elements are in a different order. The time complexity of the cod...
codefeedback
Implement a stack data structure using an array in Python. The stack should have the following functionalities: - Push: Add an element to the top of the stack. - Pop: Remove and return the element at the top of the stack. - Peek: Return the element at the top of the stack without removing it. - IsEmpty: Check if the st...
codefeedback
Create a JavaScript code snippet to get the last three characters from a given string, but the string must be reversed before extracting the last three characters. Additionally, you should use a recursive function to solve this problem. The output should be displayed in uppercase letters.
codefeedback
Reverse a string without using any built-in functions in the R programming language.
codefeedback
Analyze the computational complexity of the following piece of code, considering that the function `fun` must be implemented using an iterative approach instead of a recursive one.
codefeedback
Create a conditional statement in C++ to check if a given number is a two-digit number or not. Additionally, check if the number is even or odd.
codefeedback
Write a program in Python to implement a machine learning model for predicting the price of a certain type of car. Additionally, include a piece of erroneous code and explain how you would fix it to ensure the correct functionality of the program.
codefeedback
Explain how to use unsupervised machine learning to classify a larger dataset containing 1000 data points with 20 features each.
codefeedback
Create a web scraper that extracts the title, author, and date of publication from a given news article URL. The URL should be dynamic and allow the user to input any news article URL of their choice. Additionally, the web scraper should be able to handle different types of news articles from various sources, not just ...
codefeedback
Write a Python script to find the prime factors of a number. Number: 356
codefeedback
Compile this piece of C code to an executable program with the following requirements: 1. The program must take two integer inputs from the user. 2. The program must perform the addition of the two inputs. 3. The program must display the result of the addition. 4. The program must use a separate function to perform the...
codefeedback
Write a recursive function that makes a deep copy of a nested object. The function should handle objects, arrays, strings, numbers, booleans, and null values. You are not allowed to use any built-in methods or libraries for copying the object.
codefeedback
How to write a jQuery code to hide a specific HTML element only if it has a certain class and is not a child of another specific element?
codefeedback
Write a code that adds two integers without using any arithmetic operators and without using any bitwise operators.
codefeedback
Sort this array of dictionaries by the value of 'popularity' in descending order. Additionally, ensure that any dictionaries with a 'popularity' value of less than 3 are placed at the end of the sorted array.
codefeedback
Format the given string to capital letters and display the output. However, you should only capitalize the first letter of each word in the string, while keeping the rest of the letters lowercase. string = "this is a text" #Expected Output# "This Is A Text"
codefeedback
How to write a React component that renders an array of numbers and allows the user to sort and filter the numbers based on certain conditions?
codefeedback
Write an HTML page that displays the numbers from 1 to 10 in a table format, with each number being a hyperlink that redirects to a new page displaying the factorial of that number. The table should have a border of 1 pixel and each number should be displayed in a different font color. Additionally, the page should hav...
codefeedback
Explain what a memory leak is and provide an example of how it can be created in C++. Additionally, explain the potential consequences of not properly managing memory in a program.
codefeedback
Create an array in JavaScript containing the numbers one to ten, but the numbers must be in ascending order and each number should be repeated twice.
codefeedback
Construct a query in SQL to get the names of all customers who have made at least two purchases, where each purchase is of a product with price greater than $50, and the total amount spent by the customer on these purchases is greater than $200.
codefeedback
Create a list comprehension in Python to extract all the even numbers from a given list, while also excluding any numbers that are divisible by 3. The resulting list should be sorted in descending order. Original list: [3,4,5,6,7,8].
codefeedback
How would you search for an element in a sorted array using a binary search algorithm in Python?
codefeedback
Create a JavaScript function that takes a string as input and returns the current date formatted according to the string provided. The string can contain any combination of the following placeholders: - "%Y" for the full four-digit year (e.g., 2021) - "%y" for the two-digit year (e.g., 21) - "%M" for the full month na...
codefeedback
Write a function in C# to insert a character into a string at a given index, without using any built-in string manipulation functions or data structures.
codefeedback
Write a Java program to print the nth number in the Fibonacci sequence, but without using recursion or an iterative loop.
codefeedback
Use SQL to return the names of customers who have purchased books from the store, ordered by the total amount of money they have spent on purchases. Table names: Customers, Purchases (Note: This requires joining the two tables and using aggregate functions to calculate the total amount spent by each customer.)
codefeedback
How would you add two matrices in C++, using only bitwise operations and without using any arithmetic operators?
codefeedback
Write a JavaScript function that takes a date as input and returns the next 5 working days (excluding weekends and public holidays) from that date. You can assume that weekends are Saturdays and Sundays. To determine public holidays, you can use a hardcoded list of dates.
codefeedback
Implement the bubble sort algorithm in JavaScript. Additionally, you need to modify the algorithm to sort the elements in descending order instead of ascending order.
codefeedback
Create an in-place version of selection sort in Python. The array should have at least 10 elements and contain both positive and negative integers. The sorting should be done in descending order. You are not allowed to use any built-in sorting functions or libraries. The time complexity of your solution should be O(n^2...
codefeedback
Classify the given sentence into one of the seven categories based on the provided list of categories. The sentence must not contain any punctuation marks or special characters.
codefeedback
Write a jQuery code snippet to change the text color of all p tags to a random color from a predefined list of colors.
codefeedback
Implement a function to find the minimum value in an unsorted array of integers without using any built-in sorting functions or data structures. Time Complexity: O(n) Space Complexity: O(1) #Example# Input: [9, 2, 5, 1, 6] Output: 1
codefeedback
Construct an array in Java containing the first 100 prime numbers.
codefeedback
Implement a custom defined length function that works with strings. The custom defined length function should count the number of characters in a string, including spaces and special characters. Your function should handle edge cases such as empty strings and strings with leading or trailing spaces. You are not allo...
codefeedback
Given a binary search tree, write a program to convert it into an array. The program should handle duplicate values in the tree and should maintain the sorted order of elements in the resulting array. You are not allowed to use any built-in sorting functions or data structures.
codefeedback
Construct a python program to determine if a number is prime or composite. Additionally, ensure that the program can handle large numbers efficiently.
codefeedback
Write a code to implement Multiple Linear Regression for a large dataset with millions of records. Additional requirements: - The code should be able to handle datasets that cannot fit into memory. - The code should be optimized for efficient storage and retrieval of data. - The code should implement parallel processi...
codefeedback
Generate a function that prints all possible combinations of unique integer elements from an array, in a non-repetitive manner. Additionally, ensure that the function handles arrays of any length. Array: [1, 2, 3]
codefeedback
Translate the following JSON into an XML format, while also adding an additional nested object inside the "person" object. { "person": { "name": "Jane", "age": 30, "address": { "street": "123 Main Street", "city": "New York", "state": "NY" } } ...
codefeedback
Implement a class to calculate the sum of two numbers, but the numbers should be stored as a linked list where each digit of the number is a separate node in the list. The class should be able to handle numbers of arbitrary length.
codefeedback
Generate a function to flatten a nested list. The nested list can contain integers or other nested lists. The function should return a flattened list where all elements are integers. The input list can have an arbitrary number of nesting levels. Example: Input: [1, 2, [3, 4, [5]], [[6], 7]] Output: [1, 2, 3, 4, 5, 6, ...
codefeedback
Generate a method to print the Nth element of a Fibonacci sequence, where N is a positive integer. To solve this problem, we can use a recursive approach. We will define a recursive method called fib that takes an integer n as input and returns the Nth element of the Fibonacci sequence. 1. Define the fib method that ...
codefeedback
Construct a Fibonacci Heap class that supports the following operations: insert, extract-min, decrease-key, merge, delete, and find-min. Additionally, ensure that the insert operation runs in constant amortized time and the other operations run in O(log n) time, where n is the number of elements in the heap.
codefeedback
Explain the concept of data normalization and provide a piece of erroneous code that demonstrates how data normalization can be implemented incorrectly.
codefeedback
Replace the '?' with the correct Java keyword and ensure that the method returns the sum of the two input integers. Additionally, the method should throw an IllegalArgumentException if either of the input integers is negative or if their sum exceeds 100. The method should also be made private and static.
codefeedback
Generate an HTML form to create a user profile that includes fields for the user's name, email, password, date of birth, and address. The form should also include validation for the email field to ensure it is a valid email address and for the password field to ensure it meets certain complexity requirements (e.g. at l...
codefeedback
Construct a dictionary with the keys "name" and "age" and assign the appropriate values. The name should be a string consisting of at least 3 characters and should not contain any special characters or numbers. The age should be an integer between 18 and 60 (inclusive). Name: John Age: 25
codefeedback
Build a deep learning model using convolutional neural networks (CNN) to predict the sentiment of text data. Input dataset of 100,000 records with 50,000 features, where each feature represents a word tokenized from the text data using advanced natural language processing techniques such as word embeddings. The dataset...
codefeedback
Identify the parts of speech of the words in the sentence and create a program to generate a grammatically correct sentence using those words.
codefeedback
Generate a random text using the given code, ensuring that each word in the generated text is unique. The seed_text should be at least 5 words long and should not contain any repeated words.
codefeedback
Construct a context-free grammar (CFG) to describe the given language. The language {anbmcn | n, m ≥ 0}, where each 'a' is followed by 'b' and then 'c', and the number of 'a's is equal to the number of 'b's which is equal to the number of 'c's. The CFG should also include the rule that the number of 'a's is greater tha...
codefeedback
Write a function that takes in a number n and returns the next Fibonacci number after n. Your function should have a time complexity of O(1) and should not use any additional data structures.
codefeedback
Write a code that converts a given binary number to its equivalent decimal number. The code should handle binary numbers up to 32 bits in length and should include error handling for invalid input.
codefeedback
Create a loop that prints each letter in the given string one by one on a new line, but exclude vowels. Additionally, each letter should be printed with its corresponding ASCII value. The loop should only iterate through the string backwards and only for a specific range of indexes. string str = "Hello World"
codefeedback
encode a given string using the Base64 algorithm, ensuring that the implementation can handle strings containing non-ASCII characters. String: 東京都
codefeedback
Generate a class in Java that validates if a given number is a prime or not. The number must be between 1 and 1,000,000. The class should also provide a method that returns all prime numbers within a given range, where the range must be between 1 and 10,000. The class should be able to handle large input numbers effici...
codefeedback
Create a script to find the most and least frequent words in a given text while excluding common stop words such as "the", "is", and "a". Text: This is a sample text with a few words that should be counted and analyzed.
codefeedback
Write a function to sort a list of integers in non-increasing order. You are not allowed to use any built-in sorting functions or libraries. The function should have a time complexity of O(n^2) and should not use any additional data structures. [9, 6, 7, 4, 3, 5]
codefeedback
Edit the code to output the sum of array elements, but only consider the elements that are greater than or equal to 10. arr = [5, 20, 15, 8, 12]
codefeedback
Classify the given words into their respective part-of-speech tags, while also ensuring that the words are spelled correctly.
codefeedback
Create a function to check if an array contains any duplicate elements, while also ensuring that the array elements are sorted in ascending order and that the length of the array is less than or equal to 100. The function should return a boolean value indicating the presence of duplicate elements. Example: Input: [1, ...
codefeedback
Write a code to reverse a sentence word by word, but exclude any words that start with a vowel and have more than 5 characters.
codefeedback
Generate a random number between 0 and 1, but ensure that the generated number is unique and has not been previously generated in the current program execution, using the random module in Python.
codefeedback
Create a multi-threaded web scraper to download the HTML of a given website, ensuring that each thread is responsible for downloading a specific section of the website. The scraper should also implement a rate limiting mechanism to prevent overwhelming the server with requests, allowing a maximum of 10 requests per min...
codefeedback
Create an object-oriented Python program to simulate a simple calculator with the following functions: - Addition: Accept two numbers as input and return their sum. - Subtraction: Accept two numbers as input and return the result of subtracting the second number from the first number. - Multiplication: Accept two numbe...
codefeedback
Edit the existing HTML code to create an ordered list. <p>My favorite fruits are: Apple, Banana, Orange</p>
codefeedback
Update the code so that the function will add all numbers in the array and return the sum. Additionally, the function should handle the case when the array contains nested arrays. In such cases, the function should recursively traverse the nested arrays and add all the numbers within them to the sum. function add(arr)...
codefeedback
Write an SQL query to output an ordered list of employees with their highest salaries, but only include employees who have been with the company for at least 5 years.
codefeedback
Compute the overall rating for each product as the weighted sum of ratings given for each feature, where the weights are stored in a separate table. Each feature weight must be between 0 and 1, and the sum of all feature weights for a product must equal 1. Return the overall rating rounded to the nearest integer. produ...
codefeedback
Write a SQL query to select the name and email of all employees from table Employee who are older than 45 years. The query should also display the number of years each employee has been working in the company. The table employees has the following columns: name (string), email (string), age (integer), hire_date (date)....
codefeedback
Write a working SQL query to group employees by city and order by their salary in descending order. Also, include the total salary for each city. Employees Table | employee_id | name | city | salary | |-------------|----------|---------|--------| | 1 | Joe | London | 50 | | 2 | Fr...
codefeedback
Calculate the maximum of three numbers in Java, using only bitwise operations and without using any comparison operators. int a = 10; int b = 15; int c = 20;
codefeedback
Write a Python script to find all the numbers which are divisible by both 7 and 13, but are not multiples of 5; between 2000 and 3200 (both included).
codefeedback
Write a Python program to find all pairs of numbers in the given list whose sum is equal to the given number. The list may contain duplicate elements. nums = [1, 2, 3, 4, 5, 5, 6, 7], sum = 8
codefeedback
Write a SQL query to show the 20 most common car makes in a given table, along with the count of each make and the average year of the cars for each make. Cars Table | make | model | year | |----------|-------|------| | Honda | Civic | 2019 | | Ford | F150 | 2018 | | Toyota | Camry | 2017 | | Chevrolet|...
codefeedback
Rewrite the following code to ensure that the user can only input a valid positive integer. If the user inputs an invalid value, prompt them to enter a valid positive integer until they do so.
codefeedback
Implement a breadth-first search algorithm to find the shortest path between two nodes in a weighted graph.
codefeedback
Use a nested loop to print all possible combinations of three different numbers from 1 to 10.
codefeedback
Edit the following program to output a list of the numbers that are divisible by both 3 and 5, and are also prime numbers. numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
codefeedback
Write a function that determines the data type of a given string. The function should return one of the following strings: "integer", "float", "boolean", "string", "list", "tuple", "set", "dictionary", "function", "module". The input string can contain any valid Python object, including nested objects. The function sho...
codefeedback
Write a JavaScript program to display the Fibonacci sequence up to a given number n in the console. Requirements: - The program should take an input n from the user and display the Fibonacci sequence up to the nth number. - The program should handle invalid inputs gracefully and display an appropriate error message. -...
codefeedback