prompt stringlengths 24 5.96k | completion stringlengths 9.64k 457k |
|---|---|
def count_distinct_states(matrix):
"""
This function counts the number of distinct states in a given matrix.
Args:
matrix (list): A 2D list of characters where each sub-list represents a row in the matrix.
Returns:
int: The number of distinct states in the matrix.
"""
distinct_... | [{"ut_id": 0, "code": "import unittest\n\nclass TestCountDistinctStates(unittest.TestCase):\n \"\"\"\n Test cases for the count_distinct_states function.\n\n Each test case will validate that the function correctly counts the number of distinct states in a matrix.\n \"\"\"\n \n def test_empty_matrix(s... |
"def remove_spaces_and_punctuation(s):\n result = \"\"\n for char in s:\n ascii_value =(...TRUNCATED) | "[{\"ut_id\": 0, \"code\": \"import unittest\\n\\nclass TestRemoveSpacesAndPunctuation(unittest.Test(...TRUNCATED) |
"import math\n\ndef is_prime(n):\n # Check if the number is less than 2 or not an integer\n if(...TRUNCATED) | "[{\"ut_id\": 0, \"code\": \"import unittest\\nimport math\\n\\nclass TestIsPrimeFunction(unittest.T(...TRUNCATED) |
"def max_prime_difference(arr):\n def is_prime(n):\n if n < 2:\n return False\n(...TRUNCATED) | "[{\"ut_id\": 0, \"code\": \"import unittest\\n\\nclass TestMaxPrimeDifference(unittest.TestCase):\\(...TRUNCATED) |
"def count_letters(string):\n letter_count = {}\n for char in string:\n if char.isalpha(...TRUNCATED) | "[{\"ut_id\": 0, \"code\": \"import unittest\\n\\nclass TestCountLettersFunction(unittest.TestCase):(...TRUNCATED) |
"def fibonacci(n):\n def multiply_matrices(A, B):\n a, b, c = A[0][0], A[0][1], A[1][0]\n (...TRUNCATED) | "[{\"ut_id\": 0, \"code\": \"import unittest\\n\\nclass TestFibonacciFunction(unittest.TestCase):\\n(...TRUNCATED) |
"def debug_program(arr):\n n = len(arr)\n return binary_search(arr, 0, n - 1)\n\ndef binary_se(...TRUNCATED) | "[{\"ut_id\": 0, \"code\": \"import unittest\\n\\nclass TestDebugProgram(unittest.TestCase):\\n \(...TRUNCATED) |
"def power(x, y):\n # Check for invalid inputs\n if not isinstance(x, (int, float)) or not isi(...TRUNCATED) | "[{\"ut_id\": 0, \"code\": \"import unittest\\n\\nclass TestPowerFunction(unittest.TestCase):\\n (...TRUNCATED) |
"def bubble_sort_descending(arr):\n n = len(arr)\n for i in range(n - 1):\n for j in ra(...TRUNCATED) | "[{\"ut_id\": 0, \"code\": \"import unittest\\n\\nclass TestBubbleSortDescending(unittest.TestCase):(...TRUNCATED) |
"def calculate_factorials(arr):\n def calculate_factorial(n):\n if n == 0:\n re(...TRUNCATED) | "[{\"ut_id\": 0, \"code\": \"import unittest\\n\\nclass TestCalculateFactorials(unittest.TestCase):\(...TRUNCATED) |
End of preview. Expand in Data Studio
No dataset card yet
- Downloads last month
- 1