instruction_seed
stringlengths
29
40.5k
source
stringclasses
6 values
Sort the given list of integer numbers from highest to lowest using the bubble sort algorithm. Constraints: - The length of the list will be between 1 and 10^4. - The range of the numbers in the list will be between -10^9 and 10^9.
codefeedback
You are tasked with creating a program that simulates a simple banking system. The program should be able to handle basic banking operations such as account creation, deposit, withdrawal, and balance inquiry. The program should also be able to handle multiple accounts and perform operations on each account independentl...
codefeedback
Create a python script that connects to a MongoDB database and outputs the average age of users who have a salary greater than $50,000, are located in a specific city provided as input, and have a job title containing the word "engineer".
codefeedback
Develop a sophisticated Python script, leveraging the capabilities of the boto3 library, with the specific intention of automating the process of eliminating dormant Lambda functions within a designated AWS region. This program should not only ensure maximum resource efficiency but also incorporate robust error handlin...
codefeedback
Create a script to generate a random password using at least 1 uppercase letter, 1 lowercase letter, 1 numeric digit, and 1 special character. The password should be at least 12 characters long and should not contain any repeated characters. Additionally, the password should have at least 3 special characters, 2 numeri...
codefeedback
Create a python program challenge that involves multiple sub-challenges with varying complexities. The program must not only accept user inputs as one of the constraints but also incorporate data from a table containing additional constraints. The sub-challenges should require a multi-step thought process to arrive at ...
codefeedback
i want to read/write text local file I'm using fs like this import * as fs from "fs"; const result = fs.readFileSync("sCode.txt", { encoding: "utf-8" }); console.log(result); but i got this console error `TypeError: fs__WEBPACK_IMPORTED_MODULE_1__.readFileSync is not a function` how can i use `fs` with vuejs or if t...
codefeedback
You are tasked with creating a Python function that processes a list of keymap items and generates a report based on their properties. Each keymap item is represented by a dictionary containing the following keys: "name" (string), "show_expanded" (boolean), and "addon" (string). The function should analyze the keymap i...
codefeedback
Write a C++ program that prints out the numbers from 1 to 100, with the exception of numbers divisible by 3 being replaced with "Fizz", numbers divisible by 5 replaced with "Buzz", and numbers divisible by 7 replaced with "Woof". Additionally, numbers divisible by both 3 and 5 should be replaced with "FizzBuzz", number...
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
Create a SQL query to select the first 3 rows of a table named 'users' and display the 'id', 'name', and 'email' columns. Additionally, sort the results in descending order based on the 'id' column.
codefeedback
Write a Python function to check whether a given list of strings is a palindrome or not. A palindrome is a word, phrase, number, or other sequence of characters that reads the same forward and backward. In addition, the function should also return the longest palindrome substring found in each input string, considerin...
codefeedback
Write a function in PHP to check a given string for palindromic properties. "madam"
codefeedback
Generate an array of random integers between 1 and 100 inclusive, where no two adjacent numbers in the array are the same.
codefeedback
Create a React application for displaying a list of items. The application should have the ability to add, edit, and delete items from the list.
codefeedback
You are tasked with creating a program that parses and extracts information from API documentation comments. The comments follow a specific format, as shown in the code snippet below: ```java /** * This method retrieves user data. * @apiSuccess {int} data.id User ID * @apiSuccess {string} data.name User's name * @...
codefeedback
Create a program that takes in two strings and prints out the number of common words between them. The program should also output the unique common words in alphabetical order. Additionally, the program should ignore common words that are less than three characters long. The program should have a time complexity of O(n...
codefeedback
You are tasked with creating a Python function that compares two files and asserts whether a specific portion of one file matches the content of another file. Your task is to implement the function that performs this comparison and raises an assertion error if the content does not match. You are given the following co...
codefeedback
Jia and An are both reading two different novels. The number of pages Jia has read from her novel is 3/4 of the number of unread pages, while An has already read half of his book. They both decide to read a bit more: Jia reads another 30 pages and An reads another 50 pages. At this time, the number of pages Jia has rea...
codefeedback
You are tasked with implementing a method for creating an `ObjectSet` from a raw pointer in the context of the Fontconfig library. The `ObjectSet` represents a set of font objects, and the method `from_raw` is responsible for constructing this set from a raw pointer to a `FcObjectSet`. The method assumes ownership of t...
codefeedback
Construct a iterative mechanism which, while traversing through each individual element of an array denoted by 'l', cumulatively adds together every item within it. l = [1, 2, 3, 4]
codefeedback
You are tasked with implementing a Python class that performs a specific mathematical operation. The class should have a method that takes a single parameter and returns the result of the operation. Additionally, the class should have a method that returns the current state of the operation. Your task is to complete t...
codefeedback
Refine the given code for this specific function and add a new constraint that excludes any numbers above 100: def multiply_abs_values(lst): """ Provided a list of numerical values, return the multiplication result of the absolute values of these numbers, considering only their closest rounded-down int...
codefeedback
Merge two sorted linked lists but instead of returning it as a new list, modify one of the input lists to include the merged contents. The lists contain integer elements, including negative values. Your solution should not use extra space, other than the temporary variables. Discuss the time complexity of your solution...
codefeedback
You are tasked with creating a program that processes a list of GitHub repositories and calculates the average number of stars for repositories within a specified range. You are given a list of GitHub repositories in the following format: ``` <gh_stars>10-100 export * from './has-class'; ``` Each line represents a Git...
codefeedback
Write a SQL query to select rows from the table "Customers" where the "City" column equals "London" and the "Country" column equals "UK", and the "Age" column is greater than or equal to 30. Additionally, the result should be ordered by the "Last Name" column in descending order and should only include customers whose ...
codefeedback
Do outliers points in a time series violate stationarity assumptions? and why?
codefeedback
Create an array of five positive numbers, where each number is greater than or equal to 10, and output the result in descending order.
codefeedback
What are the similarities & dissimilarities between MLE (used to find the best parameters in logistic regression) & Gradient Descent?
codefeedback
You are tasked with implementing a method to verify the correctness of a one-shot array or span-to-array conversion. A one-shot array is an array that is only used once and then discarded. The goal is to ensure that the conversion from a span to an array, or the direct usage of the array, produces the expected results....
codefeedback
Compare the two strings using the given regular expression and return the number of matching characters. Additionally, if there are any characters that are present in string1 but not in string2 or vice versa, consider them as non-matching characters. Regular Expression: /^[a-z]+$/ Strings: string1 and string2 Constrain...
codefeedback
What's the fastest way to count the number of keys/properties of an object? Is it possible to do this without iterating over the object? I.e., without doing: var count = 0; for (k in myobj) if (myobj.hasOwnProperty(k)) ++count; (Firefox did provide a magic `__count__` property, but this was removed somewhere around...
codefeedback
Given a matrix of integers, delete the row or column that contains the least number of prime numbers.
codefeedback
Raise an error with the message "Invalid value" when the following function is called and the value of "n" is below 0. The function should also check if the value of "n" is greater than 1000000 and raise an error with the message "Value too large" if it is. The function should return the factorial of "n" if both condit...
codefeedback
Write a JavaScript program that given an array of integers, prints the maximum and minimum value of the array, as well as the average value. Additionally, the program should remove any duplicate values from the array before performing the calculations. The program should also find the median value of the array, which i...
codefeedback
Suggest a MySql query to check if a given table contains a record with specified column values, while also considering the following constraints: 1. The table should have an additional column called "email" of type VARCHAR(255). 2. The record should have a unique identifier column called "id" of type INT. 3. The speci...
codefeedback
In the provided code, implement a while loop that iteratively takes user input to decide whether to add or subtract a randomized point in the range of 1-10 from the player's points. The loop will keep running until the player's points either decrease to zero (game over) or exceed a designated threshold (victory). Also,...
codefeedback
Design a JavaScript function that creates an SVG element representing a zigzag line with adjustable angles and random colors. Additionally, include functionality to adjust line thickness, opacity and ensure that each alternate zigzag line has mirrored angles.
codefeedback
You are tasked with implementing a function to create a 3D transformation matrix for rotating an object in a graphics application. The transformation matrix is a combination of two individual rotation transformations around the X and Y axes. You are provided with a code snippet that uses the `CATransform3DConcat` func...
codefeedback
What is the Big-O notation and why is it used?
codefeedback
Develop a Python function to calculate the least amount of swaps necessary to transform one binary numeral, represented as a string, into a different one. Furthermore, your function should provide the succession of swaps executed. This succession should be depicted as a list of tuples, each tuple comprising the indices...
codefeedback
Develop a function in C to find the power of a given base to an exponent. The function should handle error cases where the base or exponent is negative, and also handle the case where the exponent is a floating-point number. If the base or exponent is negative, or if the exponent is greater than 100, the function shoul...
codefeedback
Generate a function in Java to calculate the sum of all prime digits for any given integer, without using any loops or recursion. The input integer can be a positive or negative number within the range of -10^9 to 10^9. Additional requirement: The function should have a space complexity of O(1) and a time complexity o...
codefeedback
Create a search algorithm in Python to find the median of a sorted array in less than log(n) time. arr = [1, 2, 3, 4, 5, 6, 7, 8]
codefeedback
You are working on a data visualization application that displays density matrices for different quantum states. The code snippet provided is a part of the application's user interface, where users can select different parameters to filter and visualize the density matrices. Your task is to implement a function that ta...
codefeedback
Design a Python-based function to convert any provided string representation into snake case notation considering numbers as separate entities. The function should also take a parameter to return the string in either lowercase, uppercase or camelcase. String = "ThisIsAString123"
codefeedback
You are tasked with creating a Bash script that reads input from a file or standard input and processes the data. The script should read each line of the input and perform a specific operation on it. Your task is to complete the script by implementing the missing functionality. The provided code snippet is the beginni...
codefeedback
Calculate the number of valid permutations of length n with respect to a given set of n distinct elements, where each element can only appear once in a permutation and there are certain constraints on the order of elements. The constraints are as follows: 1. The first element in the permutation can be any of the n dis...
codefeedback
Write a function that returns the total number of keys in a dictionary where the keys are the first three letters of the names of the first five Fibonacci numbers and the values are the corresponding full names of those Fibonacci numbers. Also ensure the function returns the dictionary in ascending order based on the l...
codefeedback
Create a list of length 'm' using an input 'm'. Then, generate another list that represents the factorial of each element in the initial list. Finally, find the product of the odd indexed elements in the factorial list. The input 'm' array will be filled with the first 'm' prime numbers. For example, if 'm' = 5, then t...
codefeedback
Write a C++ program to find the sum of all the perfect numbers between two given inputs. Additionally, the program should identify prime factors for each number in the range and determine the number of divisors for each perfect number. Output the prime factors, divisors, and the sum of the perfect numbers found in the ...
codefeedback
Read a given text and classify each sentence as true or false. text = "The sky is blue, the sea is blue. The grass is green."
codefeedback
What is the date of vacancy when the date of appointment is 28 november 2007 and replaced by is alex mcleish? table name: table_10592536_8 | | Team | Outgoing manager | Manner of departure | Date of vacancy | Replaced by | Date of appointment | Position in table | |---:|:----...
codefeedback
You are tasked with implementing a testing function for a `PendingStreamWritesManager` class, which manages pending write operations on a stream. The function should assert various conditions to ensure the correctness of the write operations and the resulting promise states. The function takes the following parameters...
codefeedback
You are tasked with implementing a function to create an executable folder with a given name. The function should handle any exceptions that may occur during the folder creation process. You are provided with a code snippet that demonstrates the use of a temporary directory and a function call to create the executable ...
codefeedback
Implement an efficient algorithm for reversing a sentence in C. Your task is to identify and fix the error in the given code so that it correctly reverses the sentence. However, this time, you are not allowed to use any string library functions (such as `strlen`, `strcpy`, `strcat`, etc.), any additional memory, or any...
codefeedback
Please consult with the existing API documented at: https://jsonplaceholder.typicode.com/users, and construct a precise programming script that efficiently retrieves and visually presents the end-user's personal identification, electronic mailbox address, and their corresponding corporate entity's name.
codefeedback
Write a HTML code for creating a dropdown list with 10 list items. Add a functionality that allows the user to select multiple items from the dropdown list, but limit the maximum number of selected items to 3. Display the selected items below the dropdown list. Additionally, add a button that when clicked, clears the s...
codefeedback
How can you create a new dataframe that ensures that each value in the 'text1' and 'text2' columns is 20 characters or less, and excludes any rows with 'NaN' values? Additionally, how can you guarantee that the values in 'text1' and 'text2' columns do not overlap with each other, and the 'text' column is split into 'te...
codefeedback
Implement an SVM model with sci-kit-learn using this dataset: https://archive.ics.uci.edu/ml/datasets/Census+Income. Preprocess and partition the dataset appropriately before training. Report the model's precision, recall and F1 score, along with an ROC curve.
codefeedback
Given two sorted arrays, find elements that exist in both arrays. arr1 = [1, 2, 5, 8, 9, 10] arr2 = [2, 5, 6, 9]
codefeedback
Write a code to insert a specific element at the beginning of an array and shift all other elements to the right. The array should have a fixed length of 10 and should only store integers between 1 and 100 (inclusive). If the array is already full, the oldest element should be removed before inserting the new element. ...
codefeedback
Write code to sort a given array of strings in descending order based on the length of each string. The sorting algorithm should have a time complexity of O(nlogn) and should not use any built-in sorting functions or libraries. Additionally, the solution should be implemented in a language that does not support any str...
codefeedback
You are working on a data decoding service that involves binding a JSON parser using Mojo, a framework for enabling inter-process communication in Chromium-based projects. The `DataDecoderService` class has a method `BindJsonParser` that takes a `mojo::PendingReceiver` of type `mojom::JsonParser` as a parameter. The me...
codefeedback
Create a Python function which takes a list of arrays. For each array, the function should return true if the array contains all unique values and false if it does not. After checking all arrays, the function should return the array which has the maximum number of unique values. If there are multiple such arrays, retur...
codefeedback
Implement an efficient algorithm for reversing a sentence in C. Your task is to identify and fix the error in the given code so that it correctly reverses the sentence. "This is a sentence." Note: You are not allowed to use any string library functions (such as `strlen`, `strcpy`, `strcat`, etc.) or any additional m...
codefeedback
Create an iOS app that calculates and shows the currency conversion rate between two different countries, but the app should also display the conversion rates for all available currencies in the world, not just between two specific countries.
codefeedback
You are tasked with implementing a custom C++ class for a financial library that represents a Consumer Price Index (CPI) index specific to the Danish Krone (DKK) currency. The class should inherit from the QuantLib `InflationIndex` class and provide functionality for calculating and retrieving the inflation index value...
codefeedback
Create a switch statement to convert a string input to its corresponding enumerated type. The enumerated type should consist of the colors of the rainbow: "Red", "Orange", "Yellow", "Green", "Blue", "Indigo", "Violet". Additionally, the switch statement should be implemented using a custom-defined enumeration class ins...
codefeedback
This task pertains to the problem of Redundant Connection. The problem's context is as follows: A tree is defined as an undirected graph that is interconnected and devoid of cycles. The input provided is a graph that initially was a tree comprising N nodes (each with unique values ranging from 1 to N), with an extra ...
codefeedback
You are tasked with implementing a Markov Random Field (MRF) algorithm for image denoising. The MRF method aims to remove noise from an image by considering the relationships between neighboring pixels. The algorithm involves iterating through the pixels of the image and updating their values based on the values of nei...
codefeedback
When I create window form application it works fine but when I install on other system it shows database error. so how to develop an application where the connection string is changed by the time of installation or what type of database should be used. I installed sql server databases, sql management studio in the targ...
codefeedback
Generate a new array and store only elements that are greater than the average of the array. The new array should also have an odd length and the elements should be sorted in descending order. arr = [3, 9, 8, 1, 6, 4]
codefeedback
Write a less mixin function to alter the text shadow of a web page
codefeedback
Generate a list with the numbers from 1 to 10 in reverse order using Python. Your solution must use a recursive function. Your recursive function should not use any loop constructs, such as for, while, or any list comprehension.
codefeedback
Formulate an object-oriented software model to illustrate the multifaceted dimensions of a rare manuscript housed within a specialist archives system.
codefeedback
You are working on a game development project using the Amethyst game engine, which utilizes the ECS (Entity-Component-System) architecture. In this context, you need to create a system that manages the active camera in the game. The provided code snippet is a part of the ECS setup in Amethyst, where the `ActiveCamera`...
codefeedback
Create a Java method to print a binary tree in level order, but without using any additional data structures or recursion. Additionally, the tree may contain duplicate values, and you should print the duplicate nodes only once in level order traversal. Furthermore, you must implement a solution with a time complexity o...
codefeedback
i have this module import * as cborg from 'cborg' import { CID } from 'multiformats/cid' function cidEncoder (obj) { } .... when i build module with this command line "bundle": "./node_modules/.bin/esbuild ./dist/index.mjs --bundle --outfile=./dist/out.mjs", I have bundle without export default when i build ...
codefeedback
Engineer a snippet of C# programming language that delineates a foundational event observer incorporating a uniquely tailored delegate with an explicitly defined method for event response and management. The delegate should integrate with a custom EventArgs subclass for passing data. Moreover, provide a piece of erro...
codefeedback
I have this problem : K Inverse Pairs Array Description are as below: Given two integers `n` and `k`, find how many different arrays consist of numbers from `1` to `n` such that there are exactly `k` inverse pairs and no two consecutive numbers are adjacent in the array. We define an inverse pair as following: For `it...
codefeedback
Create an algorithm in Python that converts a given number from base 10 to any base between 2 and 16, without using the built-in functions or libraries for conversion. The algorithm should have a time complexity of O(log n), where n is the given number.
codefeedback
You are tasked with implementing a Python package that provides a route service for a transportation application. The package includes a module named `service`, which contains a class called `RouteService`. The `RouteService` class is responsible for handling route-related functionalities such as finding the shortest p...
codefeedback
Download this data file from: https://github.com/mwaskom/seaborn-data/blob/master/iris.csv and perform an advanced exploratory data analysis using Pandas profiling or Sweetviz. Implement feature selection techniques before applying a scikit learn model prediction for species on the iris dataset, detailing the impact on...
codefeedback
Refine the fragmented code segment ahead using a method called getClosestVowel, which expects a solitary word as a parameter. This function ought to locate the imminent vowel ensconced between dual consonants, indexed from the rear side of the word (be aware of case sensitivity). Overlook any vowels present at the init...
codefeedback
Return the names of the customers that contain the string “ali” and sort the output by the total number of occurrences of the substring "a" in the name, in descending order.
codefeedback
Construct a coding algorithm that fabricates and exhibits the first n elements of the Fibonacci sequence, a series characterized by each numeral being the aggregate of the two antecedent ones. Additionally, consider the computational efficiency and memory usage of your solution. The value of n is set to 8.
codefeedback
Generate a function that takes in an integer n as input and returns the sum of the first n positive even numbers, excluding multiples of 4. The function should have a time complexity of O(n) and a space complexity of O(1).
codefeedback
You are tasked with creating a script to manage experiment features for a machine learning model. The script will handle the creation and cleanup of necessary files and directories based on the status of the experiment. You are given a code snippet from the existing script, which includes variable assignments and cond...
codefeedback
You are tasked with implementing a simple event handling system for a mobile application. The provided code snippet contains empty event handler functions that need to be filled in with appropriate functionality. Each function corresponds to a specific application state transition and should be triggered accordingly. Y...
codefeedback
You are tasked with creating a Python package management system that can handle the installation and removal of packages. Your system should support adding new packages, removing existing packages, and displaying the list of installed packages. To achieve this, you need to implement a class `PackageManager` with the fo...
codefeedback
Write a Python function to generate a random password with length 10 containing any combination of upper and lowercase letters, numbers, and symbols. The password should meet the following requirements: 1. At least two uppercase letters. 2. At least two lowercase letters. 3. At least two numbers. 4. At least two symbo...
codefeedback
Could you elucidate the step-by-step methodology necessary for leveraging the functionalities of Amazon Web Services' DynamoDB as a storage backbone for my MongoDB NoSQL database? Furthermore, what specific elements should I scrupulously consider during this process to guarantee peak efficiency and bolstered data prote...
codefeedback
Devise a comprehensive schematic for a sophisticated software tailored for intelligent eyewear, harnessing the capabilities of Augmented Reality (AR) and Image Recognition systems. This progressive fusion should have the capacity to discern and label entities or events within the visual range, metamorphose textual comp...
codefeedback
Devise a 1-dimensional matrix, that is, an array of length 10, and populate each element within this matrix with arbitrary numbers that fall within the numerical range of 1 to 10.
codefeedback
You are tasked with implementing a matrix multiplication function for 4x4 matrices. The matrix is represented as a 1D array of 16 elements, where the elements are stored in row-major order. The multiplication should be performed according to the standard matrix multiplication rules. You need to write a function that ta...
codefeedback
You are working on a logistics optimization application for a transportation company that owns both large and small trucks. The company records indicate that with 4 large trucks and 7 small trucks, they can transport 17 tons of goods. When they use 8 large trucks and 15 small trucks, they can move 52 tons of merchand...
codefeedback
Design a data structure for efficiently finding the k closest inputs to a given input in a set of inputs, where k is a constant. Additionally, the inputs can be of different types (e.g. integers, strings, objects) and should be compared based on a specific property or attribute.
codefeedback
Manipulate the string "Hello, World!" using the correct Python function that will replace the word "Hello" with "Goodbye", but ensure that the replacement is case-sensitive and only replaces the word "Hello" if it appears at the beginning of a sentence (i.e., capitalized, followed by a comma, and preceded by a space). ...
codefeedback
You are tasked with creating a Python function that processes video data to identify matching attributes between two video objects. The function should take in two arguments: `self` representing the first video object and `video` representing the second video object. The function should return a set of matching attribu...
codefeedback