instruction_seed
stringlengths
29
40.5k
source
stringclasses
6 values
Develop a Python subroutine capable of calculating the symmetric dissimilarity, which refers to the items that are present in either one of the supplied numeric collections, excluding elements found in both. The input consists of the following 5 distinct array entities and you must handle null and repeating values as w...
codefeedback
Write a JavaScript code to print two different pyramid patterns for a given number of rows. The first pyramid pattern should be the standard pyramid, while the second pyramid pattern should be inverted. Additionally, add a validation check to ensure the number of rows entered is a positive integer. Calculate and print ...
codefeedback
Generate an HTML table that displays the names and ages of employees in a company. [{'name': 'John Doe', 'age': 32}, {'name': 'Jane Doe', 'age': 28}, {'name': 'Jack Doe', 'age': 41}]
codefeedback
Given a list of integers, write a Python code snippet to print the elements of the list in reverse order without using any built-in functions or additional data structures. Additionally, the code should have a space complexity of O(1), meaning that it should not use any extra memory except for a few integer variables. ...
codefeedback
Calculate the factorial of n using a recursive function. The function should also check if n is a positive integer and raise an exception if it is not. Additionally, implement a caching mechanism to store previously calculated factorial values in order to optimize the recursive function.
codefeedback
Write a function that takes two strings as input, one being a base string and the other being a sub-string, and returns True if the sub-string appears in the base string and False otherwise. The function should also handle cases where the sub-string is present in the base string but with different letter case. For exa...
codefeedback
Create a machine learning model in Python to predict the total surface area of a cube given its side length side_length = 3
codefeedback
Generate a 5-element tuple of random numbers between 5 and 15 using Python.
codefeedback
Write a script in PHP for generating a random alphanumeric string of length 10. The generated string should not contain any repeated characters. Additionally, the generated string should always start with a letter and end with a number.
codefeedback
Create an HTML page of a multi-step registration form that includes the following steps: Step 1: Name and Email - Name field should only accept alphabetical characters and have a maximum length of 30 characters. - Email field should have a valid email format and be unique among existing users in the database. Step 2...
codefeedback
Develop a function that not only accurately discerns and classifies the datatype of a given input value, but also performs some specific operations based on the identified datatype. If the datatype is number, the function should return its square. If the datatype is string, convert it to uppercase and return. If the da...
codefeedback
Can you explain how to write a recursive function in Python that can solve Tower of Hanoi problem for n disks?
codefeedback
Delve deeply into the theoretical underpinning and practical aspects of K-fold Cross-validation technique, citing its advantages, limitations and potential use-cases across various scenarios within the broad context of Machine Learning paradigms.
codefeedback
You are tasked with creating a custom exception handling system for a user stack association feature in a web application. The code snippet provided is a TypeScript snippet that imports and exports a custom exception type and defines a union type for exceptions related to describing user stack associations. Your task ...
codefeedback
Create an SQL table to store information about books, authors, and publishers. Additionally, ensure that the table has proper constraints to enforce referential integrity, such as foreign key relationships between the books and authors, as well as books and publishers. Implement a trigger that automatically updates the...
codefeedback
You are working on a text processing tool that needs to parse a configuration file. The configuration file contains a list of key-value pairs, where the key is a string and the value is a description or a set of options. Each key-value pair is separated by a hyphen (-) and may span multiple lines. Your task is to write...
codefeedback
You are tasked with creating a web form validation function for a modal dialog box. The modal dialog box contains a form with two buttons: a "Close" button and a "Simpan" (Save) button. Your task is to write a JavaScript function that validates the form before it is submitted. The validation rules are as follows: - The...
codefeedback
Given a list of numbers, 1-10, write a program to determine the sum of the odd numbers.
codefeedback
You are tasked with creating a function that generates a dropdown select component in React. The function should take in the following props: - `options`: An array of strings representing the options for the dropdown select. - `updateValue`: A function that updates the selected value in the parent component. - `value`:...
codefeedback
Sort the given list in descending order according to the sum of all digits in each number. If two numbers have the same sum of digits, then sort them based on the last three digits of the number in ascending order. Additionally, if two numbers have the same sum of digits and the same last three digits, sort them based ...
codefeedback
Print the element with the second greatest value from an array named 'numbers' without using any built-in sorting functions or methods. The array 'numbers' will always contain at least 2 unique integers.
codefeedback
Edit a program to calculate and display the area of a rectangle with the following specifications: 1. The program should prompt the user to enter the length and width of the rectangle. 2. The program should validate that the user inputs are positive integers greater than 0. If the user enters invalid inputs, the progra...
codefeedback
Develop a Python code capable of computing the volume of a sphere, provided that the radius value is supplied.
codefeedback
Craft a PHP script designed to fabricate a mathematical multiplication matrix going up to the number 10.
codefeedback
Design a C++ class for a doubly-linked list with a self-adjusting feature, where the most recently searched node moves to the head of the list to optimize future search operations. Implement node deletion function as well.
codefeedback
Given a class definition, write a method to count the number of objects created in the class. However, you cannot use any built-in Python functions or modules, you cannot use any variables or data structures outside of the method, and you cannot use any loops or recursion to accomplish this task.
codefeedback
Elucidate the distinctions between a basic automation software commonly known as a 'bot' and an advanced cognitive computing system recognized as 'Artificial Intelligence'.
codefeedback
Create an algorithm that takes in an array of strings and returns a new array containing only the strings that start with the letter "a" and end with a consonant. Additionally, return the total number of matched strings. [apple, banana, alabama, arkansas, arizona, atlanta, anaconda]
codefeedback
You are tasked with creating a Python function that checks whether a given numpy array has a specific shape and performs a transformation if the shape is not as expected. Write a function called `transform_array` that takes in a numpy array `nump_array` and an integer `expected_shape`. The function should perform the ...
codefeedback
I want to use animation in my app, but it requires @property function from SCSS: @property --border-angle { syntax: "<angle>"; inherits: true; initial-value: 0turn; } Is there a way to do it in styled-components? The whole code for animation is on: [https://codepen.io/shshaw/pen/RwJwJJx](https://codepen.io/shs...
codefeedback
Generate a data structure that can efficiently store an array of words
codefeedback
You are tasked with implementing a Huffman encoding algorithm to compress and decompress data. Huffman encoding is a widely used technique for lossless data compression. In this problem, you are required to write a Python class that can encode and decode a given input string using Huffman coding. Your task is to compl...
codefeedback
Does it hold that for every unique value of a discrete random variable, y and its function q(y), the value lies within 0 and 1? And is the process of neural network learning also accomplished by minimizing the value of the loss function?
codefeedback
Write an SQL query to return the total number of student enrollments in courses from the courses table, but exclude courses that have less than 10 enrollments and have been active for more than 6 months. Additionally, sort the courses in descending order of enrollments and limit the result to the top 5 courses.
codefeedback
You are tasked with implementing a function that processes a given input string and extracts references and their corresponding locations based on a specific pattern. The input string consists of multiple items separated by commas, where each item follows the format "key=value". The function should extract the referenc...
codefeedback
Create an assembly language code that can perform the following tasks: 1. Get two numbers stored in memory addresses A and B 2. Add the two numbers 3. Check if there is an overflow due to the addition. If there is an overflow, store the overflow status at memory address C. 4. Store the result of the addition in the me...
codefeedback
Structure an HTML form taking inputs of name, age, email address, and phone number. Additionally, implement form validation to ensure that all fields are filled out correctly before submitting the form. Include error messages that are displayed if any of the fields are left empty or contain invalid data. Use appropriat...
codefeedback
can you rework this code into lua? public String productOfFractions(String fraction1, String fraction2) { String[] fraction1Parts = fraction1.split("/"); String[] fraction2Parts = fraction2.split("/"); int numerator1 = Integer.parseInt(fraction1Parts[0]); int denominator1 = Integer.parseInt(fraction1Par...
codefeedback
Construct a Python subroutine which computes the Fibonacci sequence. This subroutine ought to accept the quantity of terms desired as an input parameter and duly output the respective series. Incorporate error handling to ensure valid input, effectively extending the robustness of your function.
codefeedback
You are tasked with implementing a class for a paraboloid geometry in a ray tracing library. The paraboloid is defined as a surface of revolution, and the class should provide methods for intersection testing, calculating the normal at a given point, checking if a point is inside the paraboloid, and computing the dista...
codefeedback
Can you transpile this to Rust? ++ #include<iostream> #include<vector> #include<algorithm> #include<stdexcept> using namespace std; vector<int> strange_sort_list(vector<int>& lst) { // Error handling for invalid inputs if(lst.empty()) { throw invalid_argument("The list is empty. Please provide a valid non-emp...
codefeedback
Implement a function in a programming language of your choice that takes in three integers, `rows`, `columns`, and `value`, and returns a multi-dimensional array of size `rows` x `columns`. Each element in the array should be initialized to the product of its row and column indices multiplied by the `value`. Please pr...
codefeedback
You are given a matrix of size m x n, where each cell contains a distinct integer. Starting from the top-left cell, you need to traverse the matrix in a clockwise spiral order and collect the integers in the order of traversal. However, the matrix may contain obstacles, represented by cells with a value of -1, which ca...
codefeedback
Construct a SQL query to get the names, departments, and salaries of all employees who joined after January 1st 2018 and are earning more than $50,000 per year. Additionally, sort the results in descending order based on the salary.
codefeedback
Delve into an intricate and exhaustive investigation of quantum cryptography, emphasizing its critical role in the domain of quantum information security. Could you meticulously construct a narrative that chronologically traces the origin, development, and practical implementation of cryptographic protocols deeply embe...
codefeedback
Write a Python function to compute the factorial of an integer, with the additional requirement that the function should handle negative integers and return None for negative inputs.
codefeedback
You are tasked with implementing a function to process access logs and extract specific information from them. The access logs are represented as an associative array with three keys: "rows", "categories", and "total". The "rows" key contains an array of log entries, the "categories" key contains an array of categories...
codefeedback
Write a Python function that takes the title of a movie as input and returns its IMDB rating. You can assume that the movie title will be a string and the IMDB rating will be a floating-point number. Additionally, you should handle cases where the movie title does not exist in the IMDB database and return an appropriat...
codefeedback
Given a sentence, clean up any duplicate words. If a word appears more than once, remove all instances of that word except for the first occurrence. Return the modified sentence. Example: Input: "I love love love love coding." Output: "I love coding." Example: Input: "The sun is shining shining brightly." Output: "Th...
codefeedback
Write a web application that includes a form with multiple input fields for the user to enter their personal information, such as name, email address, phone number, and date of birth. When the submit button is clicked, the application should validate all the input fields entered by the user. If any of the input fields ...
codefeedback
Your task is to formulate a JavaScript function that is designed to intake a string variable, and outputs a permutation of it where each vowel has been substituted with the successor in the vowel sequence (a->e, e->i, i->o, o->u, u->a). For instance, the string input could be "hello world".
codefeedback
Create a program that reads a sentence, replaces all vowels with hyphens, replaces all consonants with their corresponding ASCII values, and prints the modified sentence. The program should also count the number of vowels, consonants, and hyphens in the sentence and display the counts at the end.
codefeedback
Create a front-end JavaScript application for a borrowing and lending platform.
codefeedback
Given the following code, write a function to calculate the length of the linked list without using any additional memory. ``` class Node: def __init__(self, val, next=None): self.val = val self.next = next head = Node(4, Node(3, Node(2, Node(1)))) ``` Write a function `get_linked_list_length` that takes i...
codefeedback
Write a JavaScript function that creates a 2-dimensional array with the following requirements: 1. The array should have dimensions m x n, where m and n are positive integers. 2. Each element in the array should be a randomly generated number between 0 and 10000 (inclusive). 3. The array should not contain any duplica...
codefeedback
Increase the difficulty by adding an additional requirement to the programming task: - Purge all rows from the following dataframe that have a negative value in the Age column and sort the remaining rows in descending order based on the Age column. Then, add a new column called 'Category' to the dataframe. The 'Categ...
codefeedback
Write a SQL query to return the first name, last name, salary, and department of employees from a database with the given conditions: - Table Name: Employees - Salary > 50000 - Department must have at least 3 employees with salaries greater than 50000. - Only include departments where the average salary of all employee...
codefeedback
How can you use asyncio & coroutines in Python to implement the switch between the up and down states of three coroutines, A, B, and C, while ensuring that the switch occurs only when certain thresholds are met? Each of the coroutines has two states: up and down, and the state switch of A, B, and C should be synchroniz...
codefeedback
Create a Python function to determine the total number of weekdays in a specific month and year. In addition, the function should provide the option to calculate the totals of individual weekdays (e.g., Monday, Tuesday) in the month. The function should also be able to handle different calendar systems such as the Juli...
codefeedback
Given the erroneous code snippet below, correct and modify it to formulate a regular expression pattern to pinpoint all lexemes within a given textual data set. The lexemes must exhibit the characteristic of possessing the Latin-derived alphabetic characters 'x' and 'y' in immediate sequence. Additionally, modify the r...
codefeedback
Given a matrix of integers, delete the row or column that contains the least number of prime numbers.
codefeedback
You are tasked with creating a function that simulates a simplified password encryption process. The function should take a password as input and return the encrypted hash of the password using a salt generated with a given complexity level. Write a function `encryptPassword` that takes a password string and a complex...
codefeedback
Classify the following news article into one of the 8 major topics: "Politics", "Economy", "Tech", "Science", "Culture", "Education", "Sports" or "Lifestyle". A new study by scientists from the University of California has found a link between diet and depression. #Erroneous Code# ``` int articleTopic = classifyArtic...
codefeedback
Write a function that takes in a number n and returns the nth Fibonacci number. Your function should have a time complexity of O(n) and should not use any additional data structures.
codefeedback
You are tasked with creating a web application that manages user sessions and authentication. Your task is to implement a PHP class that handles user sessions and provides methods for user authentication and logout. You are provided with a code snippet from a web page that displays a navigation bar with a user dropdow...
codefeedback
Engineer a Java-oriented computational algorithm to systematically ascertain and enumerate the occurrences of the digit '1' in a numerical value delineated in the intricate binary numeral system, keeping into account the efficiency and robustness of the code.
codefeedback
Write a code to get the median of six numbers. The numbers are stored in an array: [x, y, z, w, a, b]. You need to find the median of these six numbers. To solve this problem, you can follow these steps: 1. Initialize the array with the given numbers. 2. Sort the array in ascending order using your own sorting algori...
codefeedback
Please create a doubly linked list from the given array of numbers. Each node should have a reference to both the previous and next node. In addition, the doubly linked list should be sorted in ascending order based on the node values. ```python class DoublyListNode: def __init__(self, value): self.value ...
codefeedback
Write a code snippet for reversing the elements of a given string array alphabetically. const stringArray = ['zebra', 'apple', 'orange', 'mango', 'banana']
codefeedback
Develop an algorithm to transform an input string consisting of English alphabetic characters and specific punctuation marks into its equivalent Morse code representation. "Hello World!"
codefeedback
You are tasked with implementing a simple autocomplete feature for a search bar using a trie data structure. The autocomplete feature should suggest words based on the user's input prefix. You need to implement the `Trie` class and its associated methods to achieve this functionality. The `Trie` class should have the ...
codefeedback
You are working on a software tool for generating circuit diagrams based on input signals. The code snippet provided is a part of a function that appends information to a global variable `payload` in order to create a circuit diagram. The function takes in three parameters: `out`, `in1`, and `in2`. If `out` is `None`, ...
codefeedback
Implement a function in JavaScript that accepts two parameters - an array of integers and a separate integer. The function should change all the elements in the array to their negative values, unless the element is already negative or if it matches the separate integer. In these two cases, the element should remain unc...
codefeedback
Write a Python function to convert a long URL to a shortened one using a Hashing function, and make it reversible (i.e., design a function to decipher the shortened URL back to the original one). Test the function using the following URL: http://www.linkedin.com/home/profile?
codefeedback
Using a linear regression model in scikit-learn, predict the value of house prices given a dataset containing the area of the house in square feet and the number of rooms.
codefeedback
Develop a Python script which accepts two complex numbers from the user. The program should calculate and print the real and imaginary parts of the sum separately. Additionally, the program should also check and handle any invalid inputs that are not complex numbers.
codefeedback
Employ the NumPy package to construct a computational model emulating the Monty Hall mathematical conundrum, and devise a function that exemplifies the outcomes via a graphical representation. Assess the efficacy and accuracy of this function by deploying various quantities of model simulations.
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. Additionally, the program should also include a time limit of 1 second for the calculation, and the ...
codefeedback
Design a programming function that replaces all spaces with underscores in a given text string, but only in words that are not part of a specific set of programming languages' syntax. This function should be proficient in dealing with a variety of programming languages, including but not limited to Python, Java, C++, J...
codefeedback
I have this problem : Maximum Font to Fit a Sentence in a Screen with Line Breaks Description are as below: You are given a string `text`. We want to display `text` on a screen of width `w` and height `h`. You can choose any font size from array `fonts`, which contains the available font sizes in ascending order. You ...
codefeedback
Create a 3-dimensional array of ints in C# that contains only prime numbers and has a length of 100 in each dimension.
codefeedback
Generate an array of the first 10 Fibonacci numbers using any programming language. Ensure that your solution has a time complexity of O(n), where n is the number of Fibonacci numbers generated. Additionally, implement the solution using a recursive approach.
codefeedback
Suppose I have a list of strings and I want to find all the strings that contain either 'cat' or 'dog'. How can I use regular expressions to accomplish this task? Can you provide an example of a regular expression that matches strings containing either 'cat' or 'dog'?
codefeedback
Can you create a script that uses multiple-step reasoning to generate a table that lists the markdown files, their corresponding last modification date, and the name of the most recent author from my git repository? The script should also be able to account for any formatting or content changes made to the markdown fil...
codefeedback
You are tasked with implementing a Python function that reads a YAML file and extracts specific information from it. The YAML file contains configuration settings for a reinforcement learning environment. Your function should parse the file and return a dictionary containing the relevant configuration settings. Write ...
codefeedback
Considering the various sorting algorithms commonly studied in a college computer science course, which one demonstrates a runtime that is least influenced by the preset arrangement of the input data? Is it A) Insertion sort, B) Quicksort, C) Merge sort, or D) Selection sort?
codefeedback
Find the sum of the first 15 prime numbers, where the sum must be calculated using a recursive function and the output should be displayed in reverse order.
codefeedback
Develop a concurrent Java program to determine if any element within a linked list of floating point numbers matches a given decimal value. Include a method to append new floating point numbers to the linked list during execution. Example: linkedList = {1.2, 3.4, 5.6, 7.8} and given decimal value = 5.6.
codefeedback
Name the four programming paradigms.
codefeedback
Please implement the Quick Sort algorithm in Python. ## Requirements: - The time complexity of the solution should be O(n log n), where n is the length of the input list. - The space complexity of the solution should be O(log n), i.e., the solution should use recursion to sort the list. ## Constraints: - You should n...
codefeedback
Create a shell script to find the first ten prime numbers within a given range of 1000 to 2000. The script should also output the sum of these prime numbers at the end.
codefeedback
You are tasked with implementing a custom smart pointer class in C++. The smart pointer should mimic the behavior of `std::shared_ptr` and manage the memory of a dynamically allocated object. Your custom smart pointer should support reference counting and automatic memory deallocation when the last reference to the obj...
codefeedback
You are tasked with implementing a custom Swing component that extends a JPanel. This component should have the following requirements: 1. Overwrite the addMouseListener() method to do nothing. 2. Add a mouse event on mousePressed by calling super.addMouseListener(). 3. Replace the UIActionMap for the keyboard event. ...
codefeedback
Develop a recursive function that identifies the nth number in the Lucas sequence. Incorporate error handling to account for invalid inputs, such as negative numbers or non-integer values.
codefeedback
Given a list of strings, a list of numbers, and a target string. The target string will contain one of the strings from the string list followed by an index. For example, "Hello2" means repeat the "Hello" string the number of times listed at index 2 in the numbers list. Create a new list, where each string is repeate...
codefeedback
Develop a GraphQL API using your chosen framework and incorporate it with a service mesh for enhanced security, observability, and traffic management.
codefeedback
You are tasked with creating an extension method for a .NET Core application that adds a connection provider to the service collection. The connection provider will be used to establish connections to various data sources based on the configuration provided. Your task is to implement the `AddConnectionProvider` extens...
codefeedback
You are tasked with implementing a file manipulation utility in Rust. The utility should be able to perform operations on both single files and entire directories. The code snippet provided is a part of the utility's main functionality. The `run` function takes a `Config` struct as an argument and matches the `config.o...
codefeedback
Given an array of integers and an integer, return true if any two integers in the array add up to the given integer. arr = [1, 2, 3, 4] sum = 7
codefeedback
You are tasked with implementing a caching mechanism for a parser function in Python. The given code snippet demonstrates a global variable `GLOBAL_GRAMMAR` being used to cache the result of a parser function. If the variable is `None`, the parser function is called to initialize it, and subsequently, the cached gramma...
codefeedback