cases: - id: "sort_list" question: "Create a function that sorts a list of integers in ascending order" reference_code: python: | def sort_list(numbers): return sorted(numbers) difficulty: "easy" description: "Basic sorting function" - id: "binary_search" question: "Implement binary search algorithm for a sorted list" reference_code: python: | def binary_search(arr, target): left, right = 0, len(arr) - 1 while left <= right: mid = (left + right) // 2 if arr[mid] == target: return mid elif arr[mid] < target: left = mid + 1 else: right = mid - 1 return -1 difficulty: "medium" description: "Binary search algorithm" - id: "fibonacci" question: "Create a function that returns the nth Fibonacci number" reference_code: python: | def fibonacci(n): if n <= 1: return n a, b = 0, 1 for _ in range(2, n + 1): a, b = b, a + b return b difficulty: "easy" description: "Fibonacci sequence" - id: "two_sum" question: "Find two numbers in a list that add up to a target sum" reference_code: python: | def two_sum(nums, target): seen = {} for i, num in enumerate(nums): complement = target - num if complement in seen: return [seen[complement], i] seen[num] = i return [] difficulty: "medium" description: "Two sum problem" - id: "merge_sort" question: "Implement merge sort algorithm" reference_code: python: | def merge_sort(arr): if len(arr) <= 1: return arr mid = len(arr) // 2 left = merge_sort(arr[:mid]) right = merge_sort(arr[mid:]) return merge(left, right) def merge(left, right): result = [] i = j = 0 while i < len(left) and j < len(right): if left[i] <= right[j]: result.append(left[i]) i += 1 else: result.append(right[j]) j += 1 result.extend(left[i:]) result.extend(right[j:]) return result difficulty: "hard" description: "Merge sort implementation" - id: "class_implementation" question: "Create a class for a bank account with deposit and withdraw methods" reference_code: python: | class BankAccount: def __init__(self, initial_balance=0): self.balance = initial_balance def deposit(self, amount): if amount > 0: self.balance += amount return True return False def withdraw(self, amount): if 0 < amount <= self.balance: self.balance -= amount return True return False def get_balance(self): return self.balance difficulty: "medium" description: "Object-oriented programming"