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: ## Dynamic Longest Unique Substring\n\n### Statement\nYou are implementing the core of 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: ### Peak Sensor Readings\n\nA worldwide network of environmental sensors continuously st...
[ { "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#### Problem:\nYou are provided with a dataset contain...
[ { "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, Callable\n\ndef transform_array(arr: List[int], func: Callable[...
[ { "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 **defense grid** stores the identification codes of its activ...
[ { "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 ticketing system maintains a queue of `N` customers. The i‑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: from typing import List\n\ndef can_reach_end(grid: List[List[int]]) -> 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: Given a string, your task is to find out the minimum number of deletions required to mak...
[ { "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: ### Question\nImplement a function `critical_connections` that determines all critical c...
[ { "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 Cost Palindrome\n\n### Problem Description\nYou are an archivist restoring 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: from typing import List, Tuple\n\ndef lexicographically_smallest_tree(n: int, values: 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: ### Robot Calibration\n\nA robot has to travel through a straight line of **n** stations...
[ { "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: #Find the missing letter\n\nWrite a method that takes an array of consecutive (increasin...
[ { "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 sum_of_distinct_prime_divisors(n: int, sequence: List[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: Time Limit: 2 seconds\nMemory Limit: 256 MB\n\nProblem Statement\nYou are building a mic...
[ { "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 Task:\n\n#### Context:\nA software company is developing a music r...
[ { "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 – Budgeted Path\n\nA disaster‑zone map is represented as an `M × N` 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: ## Enchanted Forest Paths\n\nIn the ancient **Enchanted Forest** each clearing is repres...
[ { "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: Create a function `matrix_reshape` that takes two arguments: a 2D list (matrix) `mat`, 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 Statement\n\nAn ancient alien device works on a **three‑digit positive integ...
[ { "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 Rank Queries\n\n**Time Limit:** 2 seconds\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: ## System Vulnerability XOR\n\n### Problem Statement\nYou are a security analyst monitor...
[ { "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: ### First Book Position\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: ### Streaks of Steps\n\n**Time Limit:** 2 seconds\n**Memory Limit:** 256 MB\n\n#### Prob...
[ { "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_convert_to_palindrome(s: str, k: int) -> str:\n \"\"\"\n Check if it is po...
[ { "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: Polycarp is working on automating a task for bakers to prepare multiple cakes as efficie...
[ { "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: ### Regulatory Peak Subarray Count\n\n**Problem Statement**\n\nA data‑analytics platform...
[ { "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: ## Warehouse Robot with a One‑Time Conveyor\n\n### Problem Statement\nYou are given a re...
[ { "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: def empty_list(length)::\n \"\"\" Write a function to create a list of empty dictiona...
[ { "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_moves_to_palindrome(s: str) -> int:\n \"\"\" Find the minimum number of moves...
[ { "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 itertools import permutations\n\ndef generate_permutations(n: int):\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: def shortest_substring_with_all_unique_chars(s: str) -> int:\n \"\"\" \n Returns 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: class BinarySearchTree:\n \"\"\" Class for Binary Search Tree (BST) operations includ...
[ { "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 num_decodings(s: str) -> int:\n \"\"\" Given a digit string `s`, return the numbe...
[ { "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 process_queries(n: int, m: int, matrix: List[List[int]], queries: List[Tuple[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: ## Problem Statement\nYou are given a rectangular warehouse floor of size **M × N**. 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: ## Task\n\nComplete the function that receives an array of strings (`arr`) as an argumen...
[ { "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: ### Question: Implement an Efficient Directory Size Calculator\n\nYou are required to im...
[ { "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_subarray_with_sum_at_most_s(n: int, s: int, arr: List[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 min_length_subarray(nums, M):\n \"\"\"\n Return the minimum length of a contig...
[ { "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 summarize_ranges(nums: List[int]) -> List[str]:\n \"\"\"\n Summarizes the rang...
[ { "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 Adjacent Swaps to Form an Anagram\n\n**Time Limit:** 1 second  **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: Bertown is under siege! The attackers have blocked all the ways out and their cannon is ...
[ { "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 is_transpose(matrix1: List[List[int]], matrix2: List[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: You are given an integer array `nums` and an integer `k`. We call an array interval a co...
[ { "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: ### Budget Allocation with GCD‑LCM Balance\n\nYou are the manager of a small company tha...
[ { "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 list of students who belong to different clubs in school. Each student i...
[ { "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 combined_key_length(num1: str, num2: str) -> int:\n '''\n Cryptogra...
[ { "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 tallest_tree_height(n: int, t: int, trees: 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: ### Problem Statement\n\nYou are given **N** distinct tasks, numbered from **1** to **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: ### Version Control Divergence\n\nIn a large software project two source files, **S** 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: ## Problem Statement\nA research laboratory records a sequence of $N$ measurements $a_0,...
[ { "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 2D character array `board` representing a `boggle game board` with dimen...
[ { "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: String Manipulation and Data Extraction Task\n\nIn this task, you are required to implem...
[ { "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 Contact:\n def __init__(self, name: str, phone: str, email: str):\n self...
[ { "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 transport_supplies(data: str) -> List[int]:\n \"\"\" Calculate the maximum value ...
[ { "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: ### City Corridor\n\nA city planner is redesigning the skyline of a new district. The di...
[ { "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\nYou are given a **0‑indexed** array `arr` of length `N` where `...
[ { "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: ## Satellite Transmission Decoding\n\nA deep‑space satellite sends its logs using a comp...
[ { "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_lectures(t: int, test_cases: List[Tuple[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: ### Problem Statement\n\nYou are given a raw text line that represents a **legacy calcul...
[ { "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 an array of integers representing a collection of weights, where each weig...
[ { "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: ### Sorting an Array of Dates\n\n#### Scenario\nYou are developing a scheduling tool tha...
[ { "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 binary tree where each node contains a certain number of apples. You wan...
[ { "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: ### Level‑Order Tree Normalization\n\n**Problem Description**\nYou are given a binary tr...
[ { "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: import numpy as np\nimport matplotlib.pyplot as plt\nfrom scipy.optimize import curve_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: ### Timestamp Alignment\n\n**Problem Statement**\nThe navigation computer of the *Odysse...
[ { "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: ### Warm Frontiers\n\nThe newly established frontier settlement stretches along a straig...
[ { "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 Drone Fleet\n\nYou are the commander of a fleet of **N** autonomous drones....
[ { "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 sentence is a list of words that are separated by a single space with no leading or ...
[ { "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: \nNo-Zero integer is a positive integer that does not contain any 0 in its decimal repre...
[ { "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: ## K‑th Phone Mnemonic\n\n### Problem Statement\nA telecom analytics platform stores 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: Given a list of integers nums, a sliding window of size k moves from the very left of 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: ## Problem Statement\nA straight river runs through a dense forest. After a suitable cha...
[ { "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 Sum with LCM = N\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: ### Threshold Subarrays\\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: ### Minimum Surveillance Net\n\n**Time Limit:** 2 seconds\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: morse_code_dict = {\n 'A': '.-', 'B': '-...', 'C': '-.-.', 'D': '-..', 'E': '.', 'F':...
[ { "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 an online competitive programming platform, participants take part in contests to sol...
[ { "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 longest_palindromic_subsequence(s: str) -> 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 count_elements_in_range(nums: List[int], low: int, high: int) -> int:\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: ### Even‑Stone Vault\n\n**Problem Statement**\n\nDeep inside the ancient Mystic Vault, 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 connect_locations(test_cases):\n \"\"\" Find one possible way to connect location...
[ { "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 can_jump(nums: List[int]) -> str:\n \"\"\" Determine i...
[ { "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\nYou are tasked with developing a program to manage a simpl...
[ { "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 json\nfrom typing import List, Tuple\n\ndef get_student_with_highest_average(n: i...
[ { "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 the lead engineer of the Parcel Packing Unit at Globex Lo...
[ { "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 delivery robot is placed in the top‑left cell of a rectangula...
[ { "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 Skyline Visibility\n\n**Time Limit:** 2 seconds\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: Given the `inorder` and `postorder` traversal of a binary tree, construct the tree and r...
[ { "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: High-Speed Sorting Line\n\nStatement\nA high-speed sorting line contains a straight conv...
[ { "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 count_paths(m: int, n: int, grid: List[List[int]]) -> int:\n \"\"\" Count the num...
[ { "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 synchronize_files(server_files, client_files):\n \"\"\"\n Determines the 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: ### Balanced Triple Conveyor\n\nYou are in charge of a high‑speed assembly line that pla...
[ { "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: ## Checkerboard Revenue Queries\n\n### Problem Statement\nYou are hired by a data‑analyt...
[ { "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, Union\n\ndef risky_devices(n: int, device_strings: 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: In a digital marketplace, there are n products and m deals available. Each deal either o...
[ { "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\nYou are given an array of integers where each element appears 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: Write a function that rotates the elements of an `Array` to the right by a given 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: ### Problem Statement\nTwo autonomous assembly robots, **R1** and **R2**, operate inside...