messages
listlengths
3
3
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: Given a binary tree, determine the depth of the deepest leaf node. The depth of a leaf n...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: You are programming a scheduling system for a conference. The conference has a series of...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: Prime Factors\n\nProblem Statement\n\nFind the prime factorization of a given integer n....
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Minimize the Maximum Letter Frequency after Exactly k Deletions\n\n**Time Limit:** 1...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ## Task\nYou are given a grid with N rows and M columns of cells. Each cell can either b...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: Given a string s, your task is to count the frequency of each character in the string an...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def max_gold_steal(test_cases):\n \"\"\" Given an array of integers where each intege...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def max_sub_array_sum(nums: List[int]) -> int:\n \"\"\"\n Returns the maximum sum ...
[ { "role": "system", "content": "You will complete a python code block to implement the desired function. You will only write code blocks." }, { "role": "user", "content": "Complete the following python code: ```python\ndef even_odd_disparity(arr, operations):\n \"\"\"Analytics Engine – First ...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: Christopher is a talented engineer working on a space station, and his latest task is to...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Maximum Common Modulo with Updates\n\n**Time Limit:** 1 second\n\n**Memory Limit:** ...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def solve_network_routing(T: int, test_cases: List[Tuple[int, int, List[Tuple[int, int]]...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ## Rescue Drone – Minimum Cost Navigation\n\nA disaster has struck a rectangular city. T...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Coding Assessment Question\n\n**Scenario**:\nYou are tasked with building a notifica...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Data Compression Ratio Calculation\n\n#### Context\nIn computer science, data compre...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Treasury of Algoria\n\nThe kingdom of **Algoria** stores its gold in **N** vaults ar...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Scenario\nA popular fitness app wants to include a feature that tracks the longest s...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: John has a jar containing n stones lined up in a row, each with a different weight. The ...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def longest_increasing_subsequence(arr: List[int]) -> Tuple[int, List[int]]:\n \"\"\"...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ## Unread Book Recommendations (Streaming Set Difference)\n\n**Problem Statement**\nThe ...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: You are given a string consisting of lowercase and uppercase alphabetic characters. Your...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Minimum Jumps with Forbidden Tiles\n\n**Time Limit:** 1 second\n**Memory Limit:** 25...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def min_platforms_required(n: int, schedule: List[Tuple[int, int]]) -> int:\n \"\"\" ...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def letter_frequency(s: str) -> dict:\n \"\"\" Returns the frequency of each alphabet...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ## Problem Statement\nYou are a novice wizard exploring the ancient Tower of Echoes. Ins...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: **Strange Interval Printer**\n\n**Problem Statement**\nYou are given a special printer t...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: Problem Statement\nYou are in charge of a rectangular surveillance area that is divided ...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: Write a function path_finder(a, b, m, n) that finds and returns all paths from node `a` ...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def has_path(test_cases):\n \"\"\" \n In a grid-based game, you are given a 2D gri...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Scholarship Eligibility – Linear Selection\n\n**Time limit:** 2 seconds\n**Memory li...
[ { "role": "system", "content": "You will complete a python code block to implement the desired function. You will only write code blocks." }, { "role": "user", "content": "Complete the following python code: ```python\ndef load_ratios(demand, capacity):\n \"\"\"\n In a distributed data‑cen...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Problem Statement\n\n**Unique Chars Swapping Check**\n\nYou have been assigned a tas...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Magic Candy Square\n\nGerald has **n** younger brothers. He bought exactly **n²** ba...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: \nYou are given an integer array nums. You have to find the maximum sum of a pair of num...
[ { "role": "system", "content": "You will complete a python code block to implement the desired function. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def flatten(test_tuple)::\n \"\"\" Write a function to count the elemen...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ## Sensor Burst Analyzer\n\n### Statement\nA network of environmental sensors continuous...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: from typing import List\n\ndef filter_logs(logs: List[str], keyword: str) -> List[str]:\...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Coding Question\n\n#### Context\nIn managing user data for an online platform, you s...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Walk of the Ancient Map\n\n**Time Limit:** 1 second\n**Memory Limit:** 256 MB\n\n###...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Critical Sensors\n\n**Problem Statement**\n\nA city is equipped with a rectangular s...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: Given a list of integers, write a function that finds the second smallest number in the ...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: In a serene village, there exists a network of N wells connected by underground water ch...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Merge Weighted Intervals\n\n**Problem Description**\n\nA cloud‑scheduler receives a ...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Detect Suspicious 132 Pattern in Log Timestamps\n\n**Problem Statement**\n\nA securi...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: Given an integer `n`, return an array of length `n` where the `i-th` element is the numb...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def nextClosestTime(time: str) -> str:\n \"\"\" Given a time in HH:MM format, return ...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: Recently Polycarp started to develop a text editor that works only with correct bracket ...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def detect_repetitive_trips(t: int, test_cases: List[Tuple[int, List[Tuple[str, List[str...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def can_reach_end(heights: List[int], k: int) -> bool:\n \"\"\" Determine if you can ...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Meldable Min‑Heap Scheduler\n\nYou are hired to implement the core of a real‑time ta...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: You have been tasked to write a function to intelligently merge two sorted lists of inte...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ## Explorer's Teleportation Quest\n\n### Statement\nAn ancient ruin is represented by an...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: You are given a string $s$ consisting of lowercase English letters. You want to rearrang...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def trapWater(arr: list[int]) -> int:\n \"\"\"\n Function to calculate the total a...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ## Problem Description\nA new firmware version for a line of embedded sensors changes th...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: Given an array of integers A of size N and an integer K, find and return the Kth smalles...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: Balanced Log Segment\n\nProblem Statement\nA security system stores a chronological log ...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Problem Statement:\n\nDesign and implement a class called `Rectangle` in a programmi...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def coin_subset(n: int, coins: List[int], target: int) -> str:\n \"\"\"\n Returns ...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: You work for a logistics company that delivers packages across cities. Each package has ...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ## Moriarty's Cipher\n\nSherlock Holmes has intercepted a massive transmission that may ...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ## Monthly Expense Summary\n\n**Time Limit:** 1 second\n**Memory Limit:** 256 MB\n\n### ...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ## Problem Statement\n\nIn a high‑tech factory there are **N** machines arranged in a li...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Reconstruct the Highest‑Value Security Code\n\nAfter a sophisticated cyber‑attack, t...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: import heapq\n\ndef dijkstra_shortest_path(n, m, edges, start, end):\n \"\"\"Find the...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def max_non_overlapping_meetings(meetings):\n \"\"\" \n Calculate the maximum numb...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: Consider a `linked list` where each node contains a single digit and the digits are stor...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: Write a function named `sum_even_fibonacci` that calculates the sum of all the even Fibo...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: Given a matrix of dimensions m x n filled with non-negative integers, your task is to fi...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ## Rolling Ball in a Binary Maze\n\n### Problem Statement\nYou are given a rectangular m...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ## Problem Statement\nYou are given a DNA‑like sequence `S` consisting of English letter...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: **Problem Statement**\nYou are training for a marathon that passes through N checkpoints...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: from typing import List\n\ndef find_min_courses(courseList: List[str], prerequisites: Li...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: class TreeNode:\n def __init__(self, val=0, left=None, right=None):\n self.val...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: from typing import List\n\ndef validate_booking_codes(codes: List[str]) -> List[str]:\n ...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def min_cost_path(grid: List[List[int]]) -> int:\n \"\"\" There is a rectangular grid...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def longest_unique_substring(s: str) -> int:\n \"\"\" Find the length of the longest ...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: from typing import List\n\ndef exist(board: List[List[str]], word: str) -> bool:\n \"...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Lexicographically Smallest Non‑Adjacent Reordering\n\n**Time Limit:** 1 second\n\n**...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Dynamic Communication Network – Component Size Queries\n\n**Problem Statement**\n\nA...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Problem Statement\n\nA futuristic digital billboard displays a **concentric numeric ...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: You are provided with a grid of size $$$n \\times m$$$ consisting of '.' and '#'. The '....
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Problem Statement\nYou are hired by **LogiMax**, a global logistics company. Every p...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Coding Assessment Question\n\n#### Scenario\nIn this task, you are required to work ...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: James is a nature enthusiast and likes exploring the wilderness. For his next trip, he w...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ## Minimal Positive Pair Sum\n\n### Problem Statement\nA data‑analytics platform records...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ## Quadruple Sensor Activation\n\n### Problem Statement\nYou are given a linear array of...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def min_total_cost(n, product_names, m, offers):\n \"\"\"\n Determines the minimum...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def longest_contiguous_subarray(arr: List[int]) -> List[int]:\n \"\"\" Create a funct...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Optimized Transaction Processing\n\nYou are employed at a financial services company...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: Given an array of integers, you are required to find the length of the longest subarray ...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Palindrome Substring Finder\n\n**Context**: A palindrome is a word, phrase, number, ...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: \nA stepping number is an integer such that all of its adjacent digits have an absolute ...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def isBalanced(S: str) -> bool:\n \"\"\" \n Returns true if the parentheses in the...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: Consider the following grid of size `N x N`:\n\n```\n1 1 0 1\n1 1 0 0\n0 0 1 1\n1 0 1 1\...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: **Burst Detection in a Real‑Time Monitoring System**\n\nYou are in charge of a live sens...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: from typing import List, Tuple\n\ndef min_sliding_window(arr: List[int], k: int) -> List...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Elite Soldiers – Medal Parade\n\n**Time Limit:** 2 seconds\n**Memory Limit:** 512 MB...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: from typing import List, Tuple\n\ndef min_delivery_time(n: int, m: int, roads: List[Tupl...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Dynamic Navigation – Shortest Path with Edge Toggles\n\n**Time limit:** 2 seconds\n\...