conversations listlengths 3 3 |
|---|
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a python function to find the number of distinct palindromic substrings in the given string."
},
{
"from": "gpt",
"value": "Here is the code to solve this problem:\n``... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to find the smallest missing positive integer from a given list of integers."
},
{
"from": "gpt",
"value": "Here is the code to solve this problem:\n```pyth... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a python function to find the number of days between two dates."
},
{
"from": "gpt",
"value": "Here is the code to solve this problem:\n```python\nfrom datetime import... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to find the longest common prefix among a list of strings."
},
{
"from": "gpt",
"value": "Here is the code to solve this problem:\n```python\ndef find_longe... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a python function to find the sum of the digits of a given number."
},
{
"from": "gpt",
"value": "Here is the code to solve this problem:\n```python\ndef sum_Of_Digits... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a python function that takes a list of integers as input and returns a list of all the indices where 0 is present in the list. If 0 is not present in the list, return an empty lis... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to find the maximum time that can be set on a digital clock using given digits.\n\nGiven a string representing a 24-hour clock time, with some digits potentially replac... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a python function to find the k smallest elements in a list."
},
{
"from": "gpt",
"value": "Here is the code to solve this problem:\n```python\ndef kSmallestElements(a... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a Python function to convert a given list of lists into a list of tuples."
},
{
"from": "gpt",
"value": "Here is the code to solve this problem:\n```python\ndef conver... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function that given a string s and a list of words words, finds all starting indices of substring(s) in s that is a concatenation of each word in words exactly once and without ... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a python function to find the largest power of 2 less than or equal to a given number."
},
{
"from": "gpt",
"value": "Here is the code to solve this problem:\n```pytho... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to find the minimum penalty for a shop that operates from hour 0 to hour n. Customers arrive at the shop according to the string `customers`. If a customer arrives duri... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to find the minimum number of insertions needed to make a string a palindrome."
},
{
"from": "gpt",
"value": "Here is the code to solve this problem:\n```py... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to find the number of unique ways to partition a given string into substrings such that each substring is a palindrome."
},
{
"from": "gpt",
"value": "Here ... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function that takes a list of integers and returns the maximum product of any three integers from the list. The list may contain both positive and negative numbers."
},
{
... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to check if a number is a double-base palindrome.\nA double-base palindrome is a number that is a palindrome in two bases. For example, 585 is a double-base palindrome ... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a python function to find the smallest positive integer that does not occur in a given list."
},
{
"from": "gpt",
"value": "Here is the code to solve this problem:\n``... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Given a list of integers and a target sum, write a Python function that finds if there exists a pair of elements in the list whose sum is exactly equal to the given target sum. If such ... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a Python function that determines if a given set of courses can be completed based on prerequisites using the breadth-first search (BFS) algorithm. The function should return a li... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function that finds the smallest repeating cycle in a given string. The function should return the length of the repeating cycle. If there is no repeating cycle, the function sh... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to find the number of occurrences of a character in a string, ignoring case sensitivity."
},
{
"from": "gpt",
"value": "Here is the code to solve this probl... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to find the sum of the two smallest integers in a list."
},
{
"from": "gpt",
"value": "Here is the code to solve this problem:\n```python\ndef sum_two_small... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function that converts a decimal number to a Roman numeral."
},
{
"from": "gpt",
"value": "Here is the code to solve this problem:\n```python\ndef decimalToRoman(num... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a python function to find the maximum profit that can be made by buying and selling stocks given a list of daily stock prices. You are allowed to complete as many transactions as ... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a python function to find the longest subarray with equal number of 0's and 1's."
},
{
"from": "gpt",
"value": "Here is the code to solve this problem:\n```python\ndef... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to find the median of two sorted arrays."
},
{
"from": "gpt",
"value": "Here is the code to solve this problem:\n```python\ndef median_sorted(arr1, arr2):\n... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function named `count_primes` that takes an integer `n` as input and returns the count of prime numbers less than `n`. A prime number is a natural number greater than 1 that has... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a python function to check whether the given list contains a pair of consecutive duplicate elements or not."
},
{
"from": "gpt",
"value": "Here is the code to solve th... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to find the number of distinct subsequences of a given string.\n\nThe function should take a string as input and return the number of distinct subsequences of that stri... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a python function to find the sum of all even Fibonacci numbers up to a given limit."
},
{
"from": "gpt",
"value": "Here is the code to solve this problem:\n```python\... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function that takes two positive integers and returns the sum of the digits of their product."
},
{
"from": "gpt",
"value": "Here is the code to solve this problem:\... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Create a function to convert a given number into Roman Numerals. The function should accept an integer and return the Roman Numeral representation of that number. The input number will ... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a Python function that takes a list of strings and returns the longest common prefix among them."
},
{
"from": "gpt",
"value": "Here is the code to solve this problem:... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Create a function called \"findClosestSumPair\" that, given a list of integers, finds the pair of numbers in the list that, when summed, are closest to zero. If there are multiple pairs... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function that takes an array of integers and returns the maximum \"lucky integer\". A lucky integer is an integer which has a frequency in the array equal to its value. If there... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function that takes a string as input and returns all possible combinations of the string with adjacent characters swapped exactly once. The function should return a list of all... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a python function that reverses a string if it's length is a multiple of 4. If the length is not a multiple of 4, return the string as it is."
},
{
"from": "gpt",
"val... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a python function to find the majority element in a given list. The majority element is the element that appears more than n/2 times in the list, where n is the length of the list... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a python function to find the number of distinct paths from the top-left corner to the bottom-right corner of a MxN grid. The robot can only move either down or right at any point... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to convert a list of strings into a list of integers, then return the sum of all integers in the list."
},
{
"from": "gpt",
"value": "Here is the code to so... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a python function that takes a string of comma-separated numbers and returns a list of the numbers as integers."
},
{
"from": "gpt",
"value": "Here is the code to solv... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to calculate the sum of the first and third largest numbers in a list.\n\nGiven a list of integers, return the sum of the first and third largest numbers in the list. I... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to find the maximum value in a list of dictionaries based on a specified key."
},
{
"from": "gpt",
"value": "Here is the code to solve this problem:\n```pyt... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a python function to calculate the total number of divisors of a given number."
},
{
"from": "gpt",
"value": "Here is the code to solve this problem:\n```python\ndef g... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to find the number of times a target element appears in a 2D array (matrix). The matrix consists of integers and is non-empty."
},
{
"from": "gpt",
"value":... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to find the length of the longest substring in a given string which has all distinct characters."
},
{
"from": "gpt",
"value": "Here is the code to solve th... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to replace each element in a list with the maximum value of the elements that come after it. If there are no elements after it, replace it with -1."
},
{
"from"... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a python function to find the smallest power of 2 which is greater than or equal to a given number."
},
{
"from": "gpt",
"value": "Here is the code to solve this probl... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to find the largest product of two adjacent elements in a list."
},
{
"from": "gpt",
"value": "Here is the code to solve this problem:\n```python\ndef large... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a python function to find the next palindrome number for a given number. A palindrome number is a number that remains the same when its digits are reversed."
},
{
"from": ... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to find the top three most frequent words in a given list of strings. The function should return a list of tuples, where each tuple contains a word and its frequency. I... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a python function that takes a string as input and returns all possible permutations of the string with all possible letter case modifications."
},
{
"from": "gpt",
"v... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to check if a given string is a valid ISBN-10 number. An ISBN-10 number has 10 digits. The last digit can be a number from 0 to 9 or the letter 'X'. The ISBN-10 number ... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to find the second maximum element in a given list of integers."
},
{
"from": "gpt",
"value": "Here is the code to solve this problem:\n```python\ndef find_... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to check if a list of integers can be rotated to make it non-decreasing."
},
{
"from": "gpt",
"value": "Here is the code to solve this problem:\n```python\n... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a python function to find the minimum element in a rotated sorted array without duplicates."
},
{
"from": "gpt",
"value": "Here is the code to solve this problem:\n```... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a python function that will return the number of distinct case-insensitive alphabetic characters and numeric digits that occur more than once in the input string. The input string... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a python function to calculate the unique paths in a grid with obstacles. The function should return the number of unique paths from the top-left corner to the bottom-right corner... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a python function to find the number of ways to climb a staircase of n steps, given that you can climb either 1 or 2 steps at a time."
},
{
"from": "gpt",
"value": "He... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to find the longest happy prefix in a given string. A happy prefix is a non-empty prefix which is also a suffix (excluding itself)."
},
{
"from": "gpt",
"va... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a python function to find the sum of the first n natural numbers."
},
{
"from": "gpt",
"value": "Here is the code to solve this problem:\n```python\ndef sum_Of_Natural... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to check if a input string is an anagram of a palindrome string."
},
{
"from": "gpt",
"value": "Here is the code to solve this problem:\n```python\ndef isAn... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to find the number of palindrome substrings in a given string. A palindrome is a string that reads the same backward as forward."
},
{
"from": "gpt",
"value... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to check if a directed graph is a valid topological sort ordering."
},
{
"from": "gpt",
"value": "Here is the code to solve this problem:\n```python\ndef is... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a python function to reverse a linked list."
},
{
"from": "gpt",
"value": "Here is the code to solve this problem:\n```python\nclass Node:\n def __init__(self, valu... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to decode a string that has been encoded using a simple substitution cipher. In this cipher, each letter in the alphabet is replaced by a letter some fixed number of po... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function that takes in a string and checks if it is a valid ISBN-10 number. An ISBN-10 number is a 10-digit number (with or without dashes) that has the following format: `X-XXX... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to find the duplicate number in a given list of n+1 integers between 1 and n (inclusive), where each integer appears exactly once except for one number which appears tw... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function that finds the two largest non-consecutive elements in a list and returns their sum."
},
{
"from": "gpt",
"value": "Here is the code to solve this problem:\... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to remove all occurrences of a given value from a doubly linked list."
},
{
"from": "gpt",
"value": "Here is the code to solve this problem:\n```python\ncla... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a Python function that takes a list of numbers and returns a new list with every other number from the original list, starting with the first number."
},
{
"from": "gpt",
... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a python function to find the sum of all numbers in a list that are strictly increasing or strictly decreasing."
},
{
"from": "gpt",
"value": "Here is the code to solv... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to find the minimum length of a substring in a given string such that every character in the given string appears at least once in the substring."
},
{
"from": ... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a python function that takes a list of integers and returns true if there exists a triplet in the list such that the sum of the triplet is zero."
},
{
"from": "gpt",
"... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a python function to find the number of distinct substrings in a given string. A substring is a contiguous sequence of characters within a string. For example, the string \"abc\" ... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to calculate the average of all elements in a list, excluding any negative numbers."
},
{
"from": "gpt",
"value": "Here is the code to solve this problem:\n... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a python function to find the smallest palindrome number greater than the given number."
},
{
"from": "gpt",
"value": "Here is the code to solve this problem:\n```pyth... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a python function to find the maximum number of overlapping intervals among a given list of intervals."
},
{
"from": "gpt",
"value": "Here is the code to solve this pr... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a python function to find the difference between the sum of the squares of the first n natural numbers and the square of the sum of the first n natural numbers."
},
{
"fro... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combination should be a unique set of... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to find the nth prime number in the Fibonacci sequence.\nThe Fibonacci sequence is defined as follows: F(0) = 0, F(1) = 1, and F(n) = F(n-1) + F(n-2) for n >= 2.\n\nFor... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to find the maximum amount of money you can rob from a row of houses without triggering an alarm. You cannot rob two adjacent houses. The houses are arranged in a circl... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a python function to check whether the given list of numbers is in strictly increasing or decreasing order."
},
{
"from": "gpt",
"value": "Here is the code to solve th... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a python function to return the largest Fibonacci number in a given list of positive integers. The Fibonacci sequence is defined as each number being the sum of the two preceding ... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to check if a number can be represented as the sum of any two distinct numbers from a given list."
},
{
"from": "gpt",
"value": "Here is the code to solve t... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a python function to check if a list of strings is sorted in lexicographical order."
},
{
"from": "gpt",
"value": "Here is the code to solve this problem:\n```python\n... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function that takes a list of non-negative integers and returns a new list consisting of the squares of the original list's elements. The function should handle both empty lists... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a python function which returns the sublist of strings that contains only unique characters."
},
{
"from": "gpt",
"value": "Here is the code to solve this problem:\n``... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to compress a string by counting the consecutive occurrences of each character and replacing it with the character followed by the count. If the compressed string is no... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a Python function to check if a given string can be constructed by repeating a substring of it multiple times."
},
{
"from": "gpt",
"value": "Here is the code to solve... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function that takes a list of strings and returns a list of tuples containing the length of each string and the string itself."
},
{
"from": "gpt",
"value": "Here is... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a python function to check if a given string is a valid IPv4 address."
},
{
"from": "gpt",
"value": "Here is the code to solve this problem:\n```python\ndef check_vali... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to remove the first and last characters of a string if they are parentheses, square brackets, or curly braces. The function should only remove the outermost pair of par... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to find the two numbers in an array that add up to a specific target and return their indices."
},
{
"from": "gpt",
"value": "Here is the code to solve this... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a python function to check if a given list of strings is sorted in a specific order. The specific order is defined by a given string representing the order of the alphabet."
},
... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "You are given a list of integers. Write a function to find the two non-overlapping subarrays with the maximum sum. Return the start and end indices of both subarrays."
},
{
"fro... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a python function to check if a given string is a rotation of a substring of another given string."
},
{
"from": "gpt",
"value": "Here is the code to solve this proble... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to find the smallest and the largest number in a list of integers."
},
{
"from": "gpt",
"value": "Here is the code to solve this problem:\n```python\ndef sm... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a python function to find the number of provinces in a given adjacency matrix. A province is a group of directly or indirectly connected cities and no city outside of the group."
... |
[
{
"from": "system",
"value": "You are an assistant that responds to the user."
},
{
"from": "human",
"value": "Write a function to calculate the sum of series 1!+2!+3!+….+n!."
},
{
"from": "gpt",
"value": "Here is the code to solve this problem:\n```python\ndef sum_of_factorials(numb... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.