messages
listlengths
2
2
source
stringclasses
1 value
[ { "content": "Create a while loop in Python to increment a counter by 1 until it reaches 100, but make sure to use a break statement inside the loop to exit the loop when the counter reaches a prime number. Additionally, implement a function to check if a number is prime and use this function within the loop.",...
codefeedback
[ { "content": "Build a quickly-sortable tree from a given array.\nArray = [3, 8, 4, 5, 2, 10, 7]\n\nAdditional Instructions:\n1. Implement the sorting algorithm yourself instead of using built-in sort functions.\n2. The tree should be built in a way that allows for efficient insertion and retrieval of elements.\...
codefeedback
[ { "content": "Write a function that takes two strings and determines if the first string is one character away from the second string. The function should handle case sensitivity and whitespace. Additionally, the function should return False if the two strings have a difference in length greater than 1. The fun...
codefeedback
[ { "content": "Write a function that returns the number of times an element appears in a sorted array. The function should only use a single loop and have a time complexity of O(log n), where n is the size of the array. The array will contain at most 10^9 elements and the element to search for will be a positive...
codefeedback
[ { "content": "Write a function to determine the largest prime number in a sorted array of integers. The function should have a time complexity of O(log n) and a space complexity of O(1).\narray = [1, 3, 4, 6, 8]", "role": "user" }, { "content": "To find the largest prime number in a sorted array of ...
codefeedback
[ { "content": "Write a for loop for printing the first 10 powers of 3, starting from 3^0, but you are not allowed to use the exponentiation operator or any built-in function that calculates powers.", "role": "user" }, { "content": "Here's a for loop in Python that prints the first 10 powers of 3 with...
codefeedback
[ { "content": "Remove all duplicates from an array of strings while preserving the order of the elements. Additionally, the resulting array should only contain strings that are palindromes.\nInput: [\"racecar\", \"apple\", \"level\", \"banana\", \"deed\", \"madam\", \"dog\", \"dad\"]\nOutput: [\"racecar\", \"lev...
codefeedback
[ { "content": "Given a 2-dimensional array of size n x m, calculate the sum of each row and store the sums in a new array of size n. Then, print out the new array.\n\narr = [\n [1, 2, 3],\n [4, 5, 6],\n [7, 8, 9]\n]\n\nExample output:\n[6, 15, 24]", "role": "user" }, { "content": "Here is one poss...
codefeedback
[ { "content": "Write a function for removing duplicate values from an array, without using any built-in methods or data structures (such as sets or dictionaries) to store unique values. Additionally, the function should be able to handle arrays containing non-integer values, including strings and objects.", ...
codefeedback
[ { "content": "Write a function that takes in a positive integer as input and returns True if the number is a prime number and False otherwise. The function should have a time complexity of O(sqrt(n)), where n is the input number.\n\nExample:\nInput: 17\nOutput: True", "role": "user" }, { "content": ...
codefeedback
[ { "content": "Implement a Turing machine in a programming language of your choice. The Turing machine should be able to simulate a specific problem, such as finding the factorial of a given number or checking the validity of a mathematical expression. Write a comprehensive set of unit tests to verify the correc...
codefeedback
[ { "content": "Implement the Mahalanobis distance formula using a def function in Python, without using any built-in functions or libraries for matrix calculations. The Mahalanobis distance formula calculates the distance between a point and a distribution by taking into account the covariance between variables....
codefeedback
[ { "content": "Create a database table for a social media application that includes the following fields: user_id (unique identifier for each user), username (must be at least 8 characters long and can contain only lowercase letters and numbers), email (must be a valid email format), password (must be at least 1...
codefeedback
[ { "content": "Write a program that takes in a list of integers and returns the smallest positive integer that is not present in the list. The program should also handle the case where the input list is empty.\n\nAdditional constraints:\n- The input list can contain up to 1,000,000 integers.\n- The input list ca...
codefeedback
[ { "content": "Design an algorithm to help a user navigate through a maze. The maze is represented as a two-dimensional grid where each cell can be either empty or blocked. The user starts at the top-left cell and must reach the bottom-right cell.\n\nYour algorithm should find a path from the start to the destin...
codefeedback
[ { "content": "Using the input \"dictionary\" of type dict, write code to print out the frequency of each word in the dictionary. Additionally, print out the words in descending order of their frequency. If two or more words have the same frequency, sort them alphabetically. The frequency of each word should be ...
codefeedback
[ { "content": "Design a memory efficient algorithm for a given problem.\nGiven a list of integers, find the average of all the elements.\nThe algorithm must have a time complexity of O(n) and use only a constant amount of extra space.\nAdditionally, the algorithm must handle negative numbers and floating-point n...
codefeedback
[ { "content": "Create a function that takes two strings as parameters, compares them, and returns 0 if they are equal, 1 if the first string is greater (based on lexicographic order), and -1 if the second string is greater. \n\nIn addition, you need to handle the following edge cases:\n\n1. If either of the stri...
codefeedback
[ { "content": "Write a program that implements a binary search algorithm to find the index of a given target value in a sorted array. The program should use the Test-Driven Development (TDD) methodology, where you write the test cases first and then implement the code to pass those tests. The binary search algor...
codefeedback
[ { "content": "Find the angle between two given vectors in a three-dimensional space. The time complexity of your solution should be O(1) and you should not use any trigonometric functions.\n\nAdditional Requirements:\n1. Implement the solution using only basic mathematical operations such as addition, subtracti...
codefeedback
[ { "content": "Write a code snippet to determine the number of prime numbers in a given array of integers. The code should also calculate the sum of all prime numbers found in the array. Additionally, the code should ignore negative integers and consider them as invalid input.", "role": "user" }, { "...
codefeedback
[ { "content": "Convert the following array of strings to a set of tuples in Python. Each tuple should contain the string from the original array along with its length and the number of vowels it contains. However, vowels should only include the letters 'a', 'e', 'i', 'o', and 'u'. Additionally, the tuples should...
codefeedback
[ { "content": "Create a function that groups a given set of numbers into continuous ranges. A continuous range is defined as a sequence of numbers where each number is exactly one greater than the previous number. Additionally, the function should return the sum of each range.\n\nExample:\n\nInput: [1, 3, 4, 6, ...
codefeedback
[ { "content": "Create a function that converts an arbitrary number from any base between 2 and 16 to its decimal representation, without using any built-in conversion functions or libraries. The function should be able to handle numbers with up to 100 digits. Additionally, the function should handle negative num...
codefeedback
[ { "content": "Given an array of numbers and a target number, write a program to check if the target number exists in the array. Output true if it exists and false if it does not. If the target number exists in the array, output its index position in the array. If the target number exists multiple times in the a...
codefeedback
[ { "content": "Design a data structure that will store name, phone number, address, email, age, and occupation of a person. Additionally, the data structure should have the following functionalities:\n\n1. Add a person to the data structure.\n2. Remove a person from the data structure.\n3. Update the details of ...
codefeedback
[ { "content": "You receive an array of numbers as input and you need to calculate the median number. However, you are not allowed to use any built-in functions or libraries to sort the array. The input array may contain both odd and even number of elements. Additionally, the array may contain duplicates and nega...
codefeedback
[ { "content": "Given a string of text, convert all uppercase letters to lowercase and remove all vowels from the string.", "role": "user" }, { "content": "Here is a Python function that takes a string as input, converts all uppercase letters to lowercase, and removes all vowels from the string:\n\n``...
codefeedback
[ { "content": "You need to write a function that validates a given password. It should only be valid if it contains at least one lowercase letter, one uppercase letter, one number, and one special character. Additionally, the password should be at least 8 characters long and should not contain any consecutive re...
codefeedback
[ { "content": "Devise a data structure to store an inventory of items in a store. Additionally, implement a method that allows the user to add an item to the inventory, considering that each item has a unique identifier. The method should handle the scenario where the user tries to add an item with an identifier...
codefeedback
[ { "content": "Create a code to print the items from a given array in reverse without using any built-in functions or methods for reversing an array. The code should only use logical steps and operations to achieve the desired result. Additionally, the code should have a time complexity of O(n), where n is the l...
codefeedback
[ { "content": "Create a code to raise a number to a given power p, using only basic arithmetic operations (addition, subtraction, multiplication, and division) and without using any built-in exponentiation functions or operators. The code should also handle negative values for both the base and the power, and re...
codefeedback
[ { "content": "Write a function that takes in a list of strings and returns True if any of the strings contains the letter `a`. Additionally, the function should ignore any strings that start with a lowercase letter. The function should have a time complexity of O(n), where n is the total number of characters in...
codefeedback
[ { "content": "Given a two-dimensional array, write a code to print the elements column-wise. The array may contain duplicate elements. Your code should also handle the case when the array is empty and return an appropriate message. Additionally, you need to handle the case when the array is not a perfect rectan...
codefeedback
[ { "content": "Filter the array based on the following condition: only include elements that are prime numbers and greater than 2. Return a new array of elements that satisfy the condition. The implementation should have a time complexity of O(n) and should not use any built-in functions or libraries that direct...
codefeedback
[ { "content": "Design an algorithm to check if a given string can be converted to a palindrome, considering only alphanumeric characters and ignoring the case. The algorithm should have a time complexity of O(n) and a space complexity of O(1), where n is the length of the input string.\n\n#Erroneous Code#\n```py...
codefeedback
[ { "content": "You are given an array of integers. Find the maximum sum of any subarray of the given array, where the subarray must have a length of at least 3 and contain only positive integers. If no such subarray exists, return 0.", "role": "user" }, { "content": "To solve this problem, we can use...
codefeedback
[ { "content": "Design a function in Python to sort a list of tuples based on the first element in descending order, while ignoring the cases of the first element. The function should handle both integer and string values in the tuples. Additionally, the function should handle tuples with more than two elements a...
codefeedback
[ { "content": "Design an algorithm to check if two given binary trees are identical, where each node contains an integer value, a character value, and a timestamp value. The algorithm should also compare the character values of the corresponding nodes and return true only if both the integer values, character va...
codefeedback
[ { "content": "Create a Python program to extract the URLs from a given list of strings, where the URLs must be in a specific format: \n- They must start with \"http://\" or \"https://\"\n- They must contain at least one dot (.) after the domain name\n- They must not contain any special characters or spaces\n- T...
codefeedback
[ { "content": "Write a code to find the most frequently occurring item in a list of integers, where the length of the list is n and each integer is in the range of 1 to m. Additionally, the code should have a time complexity of O(n) and a space complexity of O(m). Implement the solution without using any additio...
codefeedback
[ { "content": "Write a Python program to convert a given binary string to its equivalent hexadecimal representation. However, you are not allowed to use any built-in functions or libraries to perform the conversion. You must implement the conversion logic from scratch using only basic operations and data structu...
codefeedback
[ { "content": "Output the 7th prime number in an array. The array will contain both prime and non-prime numbers, and you must only consider the prime numbers when finding the 7th prime number.", "role": "user" }, { "content": "To find the 7th prime number in an array, you need to iterate over the arr...
codefeedback
[ { "content": "Construct a Python class for a camera object that includes the following methods and requirements:\n1. `capture_photo()` - captures a photo and returns the image data. The photo must be saved in a specific file format (e.g., JPEG or PNG).\n2. `record_video(duration: int)` - records a video for the...
codefeedback
[ { "content": "Implement a modified version of the quicksort algorithm to sort the given array in descending order. The array may contain duplicate elements. The algorithm should have a time complexity of O(n log n) and should not use any additional data structures or recursion.", "role": "user" }, { ...
codefeedback
[ { "content": "Edit the following code so that it prints the string \"Hello World\" to the console 10 times, but now the code must use a nested loop.", "role": "user" }, { "content": "```python\nfor i in range(10):\n for j in range(1):\n print(\"Hello World\")\n```", "role": "assistant"...
codefeedback
[ { "content": "Implement a function that takes an integer n as input and returns a matrix of size nxn consisting of the natural numbers from 1 to n^2 in row major order. The function should have a time complexity of O(n^2) and a space complexity of O(n^2).\n\nHowever, the function should also check for the follo...
codefeedback
[ { "content": "Implement the Caesar Cipher algorithm that shifts the characters in a string by a specified number of spaces. The input string can contain uppercase and lowercase letters, digits, and special characters. The shift value can be any integer between -100 and 100. The output should maintain the case s...
codefeedback
[ { "content": "Write a function that takes two parameters, an array of integers and an integer value, and returns the number of occurrences of the given value in the array. The function should have a time complexity of O(n) and a space complexity of O(1). The input array will have a maximum length of 10^5 and th...
codefeedback
[ { "content": "Construct a class which inherits from the parent class by implementing the abstract method. The implementation of the abstract method should have a time complexity of O(n^2), where n is the length of the input list. Additionally, the implementation should use only constant extra space and should n...
codefeedback
[ { "content": "Change the given string to a list of characters, where each character is represented as a string. Additionally, sort the list in descending order.", "role": "user" }, { "content": "To change a given string to a list of characters, where each character is represented as a string, and so...
codefeedback
[ { "content": "Using the heapsort algorithm, sort the following array of numbers in ascending order. Assume the array can contain up to 10^6 elements, the elements can range from -10^9 to 10^9, and the sorting algorithm should have a time complexity of O(n log n). Additionally, the implementation should be done ...
codefeedback
[ { "content": "Write a function that takes in a string and converts it to its hexadecimal representation. The function should ignore any characters that are not alphanumeric and should handle both uppercase and lowercase letters. The output should be a string with lowercase hexadecimal characters. Additionally, ...
codefeedback
[ { "content": "Write a function that takes a date and time in the format \"YYYY-MM-DD HH:MM:SS\" and converts it to the format \"DD-MM-YYYY HH:MM\". Additionally, handle any potential errors that may occur during the conversion process.\n\nThe time complexity of your solution should be O(1) and the space complex...
codefeedback
[ { "content": "Implement a function that takes in an array of strings and prints out the longest one. However, the function should ignore leading and trailing whitespace in the strings when determining the longest one. Additionally, if two or more strings have the same length, the function should print out the o...
codefeedback
[ { "content": "Use the given string to find the number of occurrences of each letter, disregarding case sensitivity and excluding any non-alphabetic characters. Additionally, you must return the count of vowels and consonants separately. Hello World", "role": "user" }, { "content": "To find the numbe...
codefeedback
[ { "content": "Write a program to find the 100th prime number that is greater than 1000.", "role": "user" }, { "content": "Here is a Python program that finds the 100th prime number greater than 1000:\n\n```python\ndef is_prime(n):\n if n <= 1:\n return False\n for i in range(2, int(n **...
codefeedback
[ { "content": "Determine whether a given string is a palindrome or not, considering alphanumeric characters only and ignoring case sensitivity. Additionally, you should now ignore all non-alphanumeric characters while determining if the string is a palindrome.\nInput: \"A man, a plan, a canal: Panama!\"", "r...
codefeedback
[ { "content": "Write a Python function that takes in a string as input and returns the number of valid jokes that can be created using the characters in the input string. The function should consider the following rules for a string to be considered a valid joke:\n\n1. The string must contain at least one vowel ...
codefeedback
[ { "content": "Explain the difference between a shallow copy and a deep copy when it comes to objects in Python. Additionally, provide a code example in Python to demonstrate how to create a deep copy of a nested list, ensuring that any mutable objects within the list are also deep copied. Your solution should n...
codefeedback
[ { "content": "Given a string containing a comma-separated list of positive and negative integers, write code to print all the even numbers and the sum of all even numbers. The string may also include floating-point numbers.\n\nstring = \"-23, 2.5, 5, -16, 1, 9.7, 8\"", "role": "user" }, { "content":...
codefeedback
[ { "content": "Given a list of lists, generate a single flattened list. However, you must solve this problem without using any built-in functions or methods that directly flatten a list. Additionally, the solution should have a time complexity of O(n) and a space complexity of O(1), where n is the total number o...
codefeedback
[ { "content": "Increase the difficulty of the given programming test by requiring the following additional specifications:\n\n1. Modify the code to remove the use of classes completely. Instead, implement the functionality using pure functions and higher-order functions.\n\n2. The `print_details` function should...
codefeedback
[ { "content": "Create a while loop to print all elements of a nested array in reverse order, with each element separated by a comma and a space.\nAdd a constraint: Do not use any built-in functions or methods to reverse the array or join the elements together.\nAdd a reference code snippet that attempts to rever...
codefeedback
[ { "content": "Create a condition statement to check if all elements in a list are unique, are in ascending order, and are even numbers. The time complexity should be less than O(n^2). Additionally, the function should return the total count of unique elements and the sum of all elements in the list.", "role...
codefeedback
[ { "content": "Write a function to reverse a doubly linked list in O(n) time complexity. However, you are not allowed to use any additional data structures or modify the values of the nodes.", "role": "user" }, { "content": "To reverse a doubly linked list without using any additional data structures...
codefeedback
[ { "content": "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 an...
codefeedback
[ { "content": "Write a function that takes in an array of positive integers and returns a new array where the elements are reversed, but only for odd integers. If an even integer is encountered, it should remain in its original position. Additionally, the function should sort the resulting array in descending or...
codefeedback
[ { "content": "Insert 1000 random unique numbers between 0 and 1000 in a list, without using any built-in functions for random number generation.", "role": "user" }, { "content": "Here is a Python code that generates 1000 random unique numbers between 0 and 1000 without using any built-in functions f...
codefeedback
[ { "content": "Create a function in python to print all prime numbers between two given values. Do not include the two given values in the output.\n\nAdditionally, implement the following optimizations in your solution to increase the difficulty:\n1. Use the Sieve of Eratosthenes algorithm to efficiently generat...
codefeedback
[ { "content": "Write a Python program to parse a text string given a regular expression and return the matches. However, you must implement the regular expression parsing algorithm from scratch without using any built-in regular expression libraries or functions. Additionally, the program should handle regular e...
codefeedback
[ { "content": "Print out the Fibonacci series up to a given number, but only if the number is both prime and a perfect square.\nn = 10", "role": "user" }, { "content": "The Fibonacci series is a sequence of numbers in which each number is the sum of the two preceding ones. To solve this problem, we n...
codefeedback
[ { "content": "Create a function that takes in a positive integer greater than 1 and returns true if the number is a prime number and false if it is not. The function should also check if the input is within the range of 2 to 10^9, inclusive. Additionally, optimize your solution to have a time complexity of O(sq...
codefeedback
[ { "content": "Create a function that takes an array of arrays of numbers, calculates the sum of the numbers across all the arrays, and returns the average of those sums. Each array within the main array can have a different length.\n\narr = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12, 13]]\n\nAdditional Requi...
codefeedback
[ { "content": "Use Python to reverse the order of a string input, while also ensuring that all vowels in the original string are replaced with the corresponding vowel from a given list of replacements. Additionally, the program should ignore any non-alphabetic characters in the string input.", "role": "user"...
codefeedback
[ { "content": "Design a program to count the total number of even numbers in a given array, but now the program should also output the sum of all the even numbers in the array. Additionally, the program should handle arrays with a size of up to 10^9 elements.\n\nFurthermore, the program should also check for any...
codefeedback
[ { "content": "Write a Python function to create a dictionary with the given list as its keys and values, where each value is a list of integers. The length of the list should be determined by the index of the key in the given list. The function should also handle cases where the list contains duplicate elements...
codefeedback
[ { "content": "Compute the average of the following ten numbers: 7, 12, 18, 23, 29, 34, 40, 45, 51, and 56. However, you are not allowed to use any arithmetic operators (+, -, *, /) or the built-in average function in your solution. Additionally, your solution must have a time complexity of O(n) and a space comp...
codefeedback
[ { "content": "Using the given array, create a function that takes in two arguments, the array and a number, and returns the position of the number in the array. The function should have a time complexity of O(log n) or better, where n is the length of the array. Additionally, the function should use a recursive...
codefeedback
[ { "content": "Create an input validation function in Python which checks that the input is an integer between 2-6, is divisible by 3, and is not a prime number.", "role": "user" }, { "content": "Here is a Python function that validates the input according to the specified conditions:\n\n```python\ni...
codefeedback
[ { "content": "Make a function in Python that sorts a list of integers in increasing order. The function should not use any built-in sorting functions or methods. Additionally, the function should have a time complexity of O(n^2) and should not use any additional data structures. The input list can contain dupli...
codefeedback
[ { "content": "Change the case of all alphabetic characters in a string, but leave the punctuation and other non-alphabetic characters unchanged. The input string may contain multiple sentences.", "role": "user" }, { "content": "Here is one way to change the case of all alphabetic characters in a str...
codefeedback
[ { "content": "Implement merge sort in Python without using recursion. Your solution should have a time complexity of O(n log n) and a space complexity of O(n).", "role": "user" }, { "content": "To implement merge sort without using recursion, we can use a bottom-up approach where we repeatedly divid...
codefeedback
[ { "content": "Given a list of numbers, write a program to determine the sum of all the even numbers in the list. However, you are not allowed to use any loops or built-in functions for finding the sum or checking if a number is even. You must come up with a solution that has a time complexity of O(n) and a spac...
codefeedback
[ { "content": "Write a function to sort a stack in ascending order using only a constant amount of extra space.\n\n**Note**: You are not allowed to use any sorting algorithms or built-in sorting functions.\n\n**Example:**\n\n```python\nstack = [4, 7, 2, 1]\nsorted_stack = sort_stack(stack)\nprint(sorted_stack) ...
codefeedback
[ { "content": "Write a Python script that prints out the Fibonacci sequence up to the nth number, where n is a prime number greater than 100.", "role": "user" }, { "content": "Sure! Here's a Python script that prints out the Fibonacci sequence up to the nth number, where n is a prime number greater t...
codefeedback
[ { "content": "Create a script to convert JSON to an array, where the JSON object may contain nested objects and arrays. Additionally, modify the script to handle erroneous JSON data by including error handling code.\n\nExample JSON: \n{\n \"name\": \"John Doe\",\n \"age\": 30,\n \"address\": {\n \"street\...
codefeedback
[ { "content": "Create a function which receives two strings and checks if the characters in the first string appear in the same order as in the second string, but with an additional constraint. The function should also ensure that each character in the second string is followed by at least one space character be...
codefeedback
[ { "content": "Create a function which converts a string representation of a number in English to a numerical value. The input string will only contain numbers up to one trillion and may include decimals. The function should handle both positive and negative numbers and should ignore any additional words or char...
codefeedback
[ { "content": "Create a function that takes in a string and returns an array of the words which are longer than 10 characters and contain at least one uppercase letter and one lowercase letter.", "role": "user" }, { "content": "Here's a Python function that accomplishes this task:\n\n```python\ndef l...
codefeedback
[ { "content": "Describe two ways to insert elements into a hashmap in Python, ensuring that the keys are unique and the values are prime numbers between 1 and 1000, inclusive.", "role": "user" }, { "content": "Method 1:\n1. Create an empty hashmap.\n2. Generate a random prime number between 1 and 100...
codefeedback
[ { "content": "Given a list of languages and their corresponding translations, identify the language into which the given text is translated.\n\nText: γ„γ€γ‚‚γ‚γ‚ŠγŒγ¨γ†γ€‚\n\nLanguages:\n1. Japanese - γ„γ€γ‚‚γ‚γ‚ŠγŒγ¨γ†γ€‚\n2. English - Thank you always.\n3. French - Merci toujours.\n4. Spanish - Gracias siempre.\n5. German - Danke im...
codefeedback
[ { "content": "Increase the difficulty of the programming test question by introducing a new constraint:\n\nGenerate a loop to find the largest sub-array in a given array with contiguous elements and its sum. The sub-array must have a length of at least 2.\nArray: [-2, 6, -3, 5, -2, 3, 4, -2]\n\nProvide a piece ...
codefeedback
[ { "content": "Generate an array of 10 unique random hexadecimal numbers, each with exactly 4 characters.", "role": "user" }, { "content": "Here is an example code in Python to generate an array of 10 unique random hexadecimal numbers, each with exactly 4 characters:\n\n```python\nimport random\n\nde...
codefeedback
[ { "content": "Describe the features of the K Nearest Neighbors (KNN) classification algorithm and explain how it handles imbalanced datasets. Additionally, provide a comprehensive implementation of the algorithm in your preferred programming language, including handling of edge cases and optimization techniques...
codefeedback
[ { "content": "Find the sum of N numbers, where N is a positive integer. All N numbers should be positive integers. Given an array of N numbers, find the sum of the numbers and add M to it, where M is a positive integer. The sum of the N numbers should be greater than K, where K is a positive integer.\n\nExample...
codefeedback
[ { "content": "Write a function that takes a positive integer as input and calculates its base-2 logarithm using only bitwise operations.\n\n## Example\n\n```python\nInput: 32\nOutput: 5\n\nInput: 64\nOutput: 6\n```\n\n## Constraints\n\n- The input integer is greater than 0.", "role": "user" }, { "co...
codefeedback
[ { "content": "Given a string of text, find the count of distinct words in the string, considering specific rules and requirements.\n\nThe input string may contain multiple words separated by spaces, punctuation marks, or special characters. You need to consider each word as a distinct entity and count the numbe...
codefeedback
[ { "content": "Generate a program in Python that prints all days of the week in reverse order, but exclude the use of any built-in functions or methods that directly manipulate or reverse lists or strings.", "role": "user" }, { "content": "Here's a program in Python that prints all the days of the we...
codefeedback
[ { "content": "Sort an array of integers using a modified version of heapsort algorithm, with the additional requirement of implementing the heapsort algorithm using a min-heap data structure. The input array may contain duplicates and have a length of at least 10. Additionally, the time complexity of the algori...
codefeedback