# competitive-programming

Competitive programming is a computing activity involving programming contests, courses, problem solving, and related educational practice.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## GrandCode: Achieving Grandmaster Level in Competitive Programming via Agentic Reinforcement Learning

DevFeed: [GrandCode: Achieving Grandmaster Level in Competitive Programming via Agentic Reinforcement Learning](<https://devfeed.tech/articles/grandcode-achieving-grandmaster-level-in-competitive-programming-via-agentic-reinforcement-learning-131899.md>)

Original publisher: [Read original article](<https://arxiv.org/abs/2604.02721>)

Author: Ornith Team, Xiaoya Li, Guoyin Wang, Songqiao Su, Jiwei Li, Chris Shum

Published: 2026-11-13T05:00:00Z

Content type: article

Language: en

Sources: [arXiv: Artificial Intelligence](<https://devfeed.tech/sources/arxiv-artificial-intelligence.md>)

Topics: [competitive-programming](<https://devfeed.tech/topics/competitive-programming.md>), [Reinforcement learning](<https://devfeed.tech/topics/reinforcement-learning.md>), [grpo](<https://devfeed.tech/topics/grpo.md>), [Multi Agent Systems](<https://devfeed.tech/topics/multi-agent-systems.md>), [Artificial Intelligence](<https://devfeed.tech/topics/ai.md>)

Tags: [agentic](<https://devfeed.tech/tags/agentic.md>), [ai](<https://devfeed.tech/tags/ai.md>), [competitive-programming](<https://devfeed.tech/tags/competitive-programming.md>), [contests](<https://devfeed.tech/tags/contests.md>), [cs-ai](<https://devfeed.tech/tags/cs-ai.md>), [multi-agent](<https://devfeed.tech/tags/multi-agent.md>), [reinforcement-learning](<https://devfeed.tech/tags/reinforcement-learning.md>)

### AI overview

GrandCode combines multiple agent modules--including hypothesis proposal, solving, test generation, and summarization--and improves them through post-training and online test-time reinforcement learning. Its Agentic GRPO method is designed for multi-stage rollouts with delayed rewards and substantial off-policy drift. The abstract reports that GrandCode placed first in three consecutive live Codeforces contests (Rounds 1087-1089, March 21-29, 2026), beating all human participants, including grandmasters. These results are reported in the supplied abstract; no further evaluation details are provided.

### Source excerpt

arXiv:2604.02721v4 Announce Type: replace Abstract: Competitive programming remains one of the last few human strongholds in coding against AI. The best AI system to date still underperforms the best humans competitive programming: the most recent best result, Google's Gemini~3 Deep Think, attained 8th place even not being evaluated under live competition conditions. In this work, we introduce GrandCode, a multi-agent RL system designed for competitive programming. The capability of GrandCode is attributed to two key factors: (1) It orchestrates a variety of agentic modules (hypothesis proposal, solver, test generator, summarization, etc) and jointly improves them through post-training and online test-time RL; (2) We introduce Agentic GRPO specifically designed for multi-stage agent rollouts with delayed rewards and the severe off-policy drift that is prevalent in agentic RL. GrandCode is the first AI system that consistently beats all human participants in live contests of competitive programming: in the most recent three Codeforces live competitions, i.e., Round~1087 (Mar 21, 2026), Round~1088 (Mar 28, 2026), and Round~1089 (Mar 29, 2026), GrandCode placed first in all of them, beating all human participants, including legendary grandmasters. GrandCode shows that AI systems have reached a point where they surpass the strongest human programmers on the most competitive coding tasks.

## VeriContest: A Competitive-Programming Benchmark for Verifiable Code Generation

DevFeed: [VeriContest: A Competitive-Programming Benchmark for Verifiable Code Generation](<https://devfeed.tech/articles/vericontest-a-competitive-programming-benchmark-for-verifiable-code-generation-127184.md>)

Original publisher: [Read original article](<https://arxiv.org/abs/2605.08553>)

Author: Zichen Xie, Mrigank Pawagi, Yuxin Liu, Aaditi Rai, Lize Shao, John Berberian Jr., Sicong Che, Wenxi Wang

Published: 2026-11-10T05:00:00Z

Content type: article

Language: en

Sources: [arXiv: Software Engineering](<https://devfeed.tech/sources/arxiv-software-engineering.md>)

Topics: [competitive-programming](<https://devfeed.tech/topics/competitive-programming.md>), [Automated reasoning](<https://devfeed.tech/topics/automated-reasoning.md>), [Code](<https://devfeed.tech/topics/code.md>), [Ground truth / benchmark quality](<https://devfeed.tech/topics/ground-truth-benchmark-quality.md>), [LeetCode](<https://devfeed.tech/topics/leetcode.md>)

Tags: [benchmark](<https://devfeed.tech/tags/benchmark.md>), [bottlenecks](<https://devfeed.tech/tags/bottlenecks.md>), [code-generation](<https://devfeed.tech/tags/code-generation.md>), [competitive-programming](<https://devfeed.tech/tags/competitive-programming.md>), [cs-ai](<https://devfeed.tech/tags/cs-ai.md>), [cs-lg](<https://devfeed.tech/tags/cs-lg.md>), [cs-se](<https://devfeed.tech/tags/cs-se.md>), [evaluation](<https://devfeed.tech/tags/evaluation.md>), [formal](<https://devfeed.tech/tags/formal.md>), [large-language-models](<https://devfeed.tech/tags/large-language-models.md>), [proofs](<https://devfeed.tech/tags/proofs.md>), [rust](<https://devfeed.tech/tags/rust.md>), [synthesis](<https://devfeed.tech/tags/synthesis.md>), [test](<https://devfeed.tech/tags/test.md>), [testing](<https://devfeed.tech/tags/testing.md>), [verus](<https://devfeed.tech/tags/verus.md>)

### AI overview

VeriContest is a benchmark for evaluating code generation with machine-checkable correctness: it contains 1,006 LeetCode and Codeforces problems in Rust with Verus, including expert-validated specifications, accepted code, checked proofs, and positive and negative tests. Its three-phase construction combines manually verified seeds with semi-automated expansion and human review; testing also checks postcondition completeness. The benchmark supports isolated, compositional, and end-to-end evaluation. Across ten models, the strongest scored 97.51% on natural-language-to-code generation, versus 57.16% for specifications, 13.82% for proofs, and 6.76% end-to-end, indicating that specifications and proofs remain major bottlenecks.

### Source excerpt

arXiv:2605.08553v2 Announce Type: replace Abstract: Large language models can generate useful code from natural language, but their outputs come without correctness guarantees. Verifiable code generation offers a path beyond testing by requiring models to produce not only executable code, but also formal specifications and machine-checkable proofs. Progress in this direction, however, is difficult to measure: existing benchmarks are often small, cover only part of the pipeline, lack ground-truth proofs or rigorous specification validation, or target verification settings far from mainstream software development. We present VeriContest, a benchmark of 1,006 competitive-programming problems from LeetCode and Codeforces for verifiable code generation in Rust with Verus. Each problem includes a natural language description, expert-validated formal specifications, judge-accepted Rust code, Verus-checked proofs, and positive and negative test suites. VeriContest is constructed through a three-phase pipeline that scales from manually verified seed problems to semi-automated expansion with human-in-the-loop review. To strengthen benchmark quality, we also use testing to validate postcondition completeness. VeriContest supports both isolated and compositional evaluation of specification, code, and proof generation, and end-to-end verified program synthesis. Evaluating ten state-of-the-art models reveals a sharp gap between ordinary coding and verifiable code generation: the strongest model reaches 97.51% on natural-language-to-code generation, but only 57.16% on specification generation, 13.82% on proof generation, and 6.76% end-to-end. These results identify proof and specification generation as the central bottlenecks for current models and establish VeriContest as a rigorous platform for evaluating and training future systems that generate code with machine-checkable correctness.

## Assessing the Impact of Retrieval-Augmented Generation on Algorithmic Problem-Solving

DevFeed: [Assessing the Impact of Retrieval-Augmented Generation on Algorithmic Problem-Solving](<https://devfeed.tech/articles/assessing-the-impact-of-retrieval-augmented-generation-on-algorithmic-problem-solving-124724.md>)

Original publisher: [Read original article](<https://arxiv.org/abs/2611.09791>)

Author: Gabriel Souza Baggio, Gabriel Machado Lunardi, Guilherme Medeiros Machado, Subhankar Maity, Faiza Belbachir, Jos\\'e Palazzo Moreira de Oliveira

Published: 2026-11-09T05:00:00Z

Content type: article

Language: en

Sources: [arXiv: Artificial Intelligence](<https://devfeed.tech/sources/arxiv-artificial-intelligence.md>)

Topics: [Retrieval Augmented Generation (RAG)](<https://devfeed.tech/topics/retrieval-augmented-generation-rag.md>), [competitive-programming](<https://devfeed.tech/topics/competitive-programming.md>), [llm-reasoning](<https://devfeed.tech/topics/llm-reasoning.md>), [LLM evaluation / benchmarking](<https://devfeed.tech/topics/llm-evaluation-benchmarking.md>), [Enhancing AI model performance](<https://devfeed.tech/topics/enhancing-ai-model-performance.md>), [AI-driven information retrieval](<https://devfeed.tech/topics/ai-driven-information-retrieval.md>)

Tags: [abstract](<https://devfeed.tech/tags/abstract.md>), [addition](<https://devfeed.tech/tags/addition.md>), [advanced](<https://devfeed.tech/tags/advanced.md>), [algorithm](<https://devfeed.tech/tags/algorithm.md>), [also](<https://devfeed.tech/tags/also.md>), [analysis](<https://devfeed.tech/tags/analysis.md>), [approach](<https://devfeed.tech/tags/approach.md>), [arxiv](<https://devfeed.tech/tags/arxiv.md>), [based](<https://devfeed.tech/tags/based.md>), [behavior](<https://devfeed.tech/tags/behavior.md>), [but](<https://devfeed.tech/tags/but.md>), [capacity](<https://devfeed.tech/tags/capacity.md>), [challenges](<https://devfeed.tech/tags/challenges.md>), [code](<https://devfeed.tech/tags/code.md>), [code-generation](<https://devfeed.tech/tags/code-generation.md>), [cs-ai](<https://devfeed.tech/tags/cs-ai.md>), [cs-hc](<https://devfeed.tech/tags/cs-hc.md>), [generation](<https://devfeed.tech/tags/generation.md>), [impact](<https://devfeed.tech/tags/impact.md>), [problem-solving](<https://devfeed.tech/tags/problem-solving.md>), [retrieval](<https://devfeed.tech/tags/retrieval.md>), [retrieval-augmented-generation](<https://devfeed.tech/tags/retrieval-augmented-generation.md>)

### AI overview

The study reports that similarity-based retrieval substantially improved LLM performance on competitive programming problems in its CodeContests evaluation. The method uses embeddings and similarity search to retrieve analogous training problems, with a dynamically adjusted threshold intended to reduce retrieval noise. It compares original problem statements, randomly selected training examples, and retrieved similar examples on test problems resembling training instances, measuring pass rates and problem CodeForces Elo ratings. A Min-K membership inference analysis examines whether solutions may reflect training-data memorization. The supplied abstract does not provide numerical results or further methodological detail.

### Source excerpt

arXiv:2611.09791v1 Announce Type: new Abstract: Competitive programming problems pose distinctive challenges for Large Language Models, as they demand not only proficient code generation but also advanced algorithmic reasoning. This study presents a Retrieval-Augmented Generation approach specifically designed to enhance the capacity of Large Language Models to address such problems. Our approach integrates an embedding-based retrieval mechanism and a similarity search algorithm to identify analogous problems within a knowledge database, employing a dynamically adjusted threshold to mitigate retrieval noise. We conducted an evaluation using the CodeContests dataset, focusing on the test split problems that exhibit similarity to instances from the training split. The experimental framework considered three conditions: (i) problems provided solely with their original descriptions, (ii) problems supplemented with randomly selected examples from the training split, and (iii) problems augmented with similar examples retrieved through the proposed method. In addition, we incorporated a Min-K membership inference analysis to examine whether the generated code solutions were influenced by potential memorization of training data within the evaluated Large Language Models. This complementary perspective enables a deeper understanding of model behavior by distinguishing genuine generalization through retrieval from implicit recall of pretraining samples. Performance was assessed using both pass rates and the CodeForces Elo rating of the problems. The results provide empirical evidence that similarity-based retrieval substantially enhances Large Language Models performance in competitive programming scenarios, offering an scalable framework for improving code generation in algorithmic problem-solving contexts.

## How Prompt Style Affects AI Accuracy and Speed in Competitive Programming

DevFeed: [How Prompt Style Affects AI Accuracy and Speed in Competitive Programming](<https://devfeed.tech/articles/how-prompt-style-affects-ai-accuracy-and-speed-in-competitive-programming-96639.md>)

Original publisher: [Read original article](<https://arxiv.org/abs/2610.30223>)

Author: Saad B. Alarifi, Mohammed A. Alam

Published: 2026-10-23T04:00:00Z

Content type: news

Language: en

Sources: [arXiv: Machine Learning](<https://devfeed.tech/sources/arxiv-machine-learning.md>), [arXiv: Software Engineering](<https://devfeed.tech/sources/arxiv-software-engineering.md>)

Topics: [competitive-programming](<https://devfeed.tech/topics/competitive-programming.md>), [prompt](<https://devfeed.tech/topics/prompt.md>), [Enhancing AI model performance](<https://devfeed.tech/topics/enhancing-ai-model-performance.md>), [Machine learning](<https://devfeed.tech/topics/machine-learning.md>)

Tags: [ai](<https://devfeed.tech/tags/ai.md>), [comparison](<https://devfeed.tech/tags/comparison.md>), [competitive-programming](<https://devfeed.tech/tags/competitive-programming.md>), [computer-science](<https://devfeed.tech/tags/computer-science.md>), [cs-lg](<https://devfeed.tech/tags/cs-lg.md>), [cs-se](<https://devfeed.tech/tags/cs-se.md>), [effectiveness](<https://devfeed.tech/tags/effectiveness.md>), [gpt-5-5](<https://devfeed.tech/tags/gpt-5-5.md>), [language-models](<https://devfeed.tech/tags/language-models.md>), [large-language-models](<https://devfeed.tech/tags/large-language-models.md>), [machine-learning](<https://devfeed.tech/tags/machine-learning.md>), [median](<https://devfeed.tech/tags/median.md>), [metric](<https://devfeed.tech/tags/metric.md>), [np-hard](<https://devfeed.tech/tags/np-hard.md>), [outlier](<https://devfeed.tech/tags/outlier.md>), [performance](<https://devfeed.tech/tags/performance.md>), [programming](<https://devfeed.tech/tags/programming.md>), [prompt](<https://devfeed.tech/tags/prompt.md>), [prompting](<https://devfeed.tech/tags/prompting.md>), [runtime](<https://devfeed.tech/tags/runtime.md>), [speed](<https://devfeed.tech/tags/speed.md>), [style](<https://devfeed.tech/tags/style.md>)

### AI overview

In an exploratory GPT-5.5 study, no prompt style performed best across all competitive programming tasks: the strongest style varied by task and by whether results were summarized with the mean or median. The researchers tested one prompt in each of nine styles on three IOI accuracy tasks and two NP-hard runtime tasks. A few outlier runs drove many mean-score differences, so a single metric can hide variability. In a descriptive comparison under different conditions, GPT-5.5 exceeded the average human contestant on one IOI task and fell short on two. These findings are limited to the tasks studied.

### Source excerpt

arXiv:2610.30223v1 Announce Type: cross Abstract: Large language models are increasingly used in competitive programming, and their outputs are sensitive to how a prompt is phrased. Prior work has compared prompt strategies for accuracy on competitive programming, but not for runtime speed, and has not situated the results against human performance. In an exploratory study of one prompt in each of nine styles on GPT-5.5 across three accuracy tasks from the International Olympiad in Informatics (IOI) and two NP-hard speed tasks, we found that no single prompt was best: the strongest prompt depended on the task type and on whether results were summarized by the mean or the median, suggesting that, at least for these tasks, prompt style should be matched to the objective rather than treated as universal. Many differences in mean scores came from a few outlier runs, showing that evaluating prompting by a single metric can obscure how much its effectiveness varies. Compared descriptively with human IOI contestants, who worked under different conditions, the AI was neither strictly better nor strictly worse, exceeding the average contestant on one task but falling short on the other two. By extending prompt comparison from accuracy to runtime speed and grounding it against human performance, this study gives a broader picture of how prompt style affects competitive programming performance.

## Ideas and Solutions for Advent of Code 2021 in Kotlin -- Part 3/4

DevFeed: [Ideas and Solutions for Advent of Code 2021 in Kotlin -- Part 3/4](<https://devfeed.tech/articles/ideas-and-solutions-for-advent-of-code-2021-in-kotlin-part-3-4-24735.md>)

Original publisher: [Read original article](<https://medium.com/xorum-io/ideas-and-solutions-for-advent-of-code-2021-in-kotlin-part-3-4-dbfd577703cc?source=rss----92bb7980cc9f---4>)

Author: Yev Kanivets

Published: 2021-12-26T14:22:49Z

Content type: tutorial

Language: en

Sources: [xorum.io](<https://devfeed.tech/sources/xorum-io-medium.md>)

Topics: [Advent of Code](<https://devfeed.tech/topics/advent-of-code.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [competitive-programming](<https://devfeed.tech/topics/competitive-programming.md>), [Graphs](<https://devfeed.tech/topics/graphs.md>), [Mathematics](<https://devfeed.tech/topics/mathematics.md>)

Tags: [advent-of-code](<https://devfeed.tech/tags/advent-of-code.md>), [algorithms](<https://devfeed.tech/tags/algorithms.md>), [array](<https://devfeed.tech/tags/array.md>), [code](<https://devfeed.tech/tags/code.md>), [competitive-programming](<https://devfeed.tech/tags/competitive-programming.md>), [data-structures](<https://devfeed.tech/tags/data-structures.md>), [graph-theory](<https://devfeed.tech/tags/graph-theory.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [memory](<https://devfeed.tech/tags/memory.md>), [pairs](<https://devfeed.tech/tags/pairs.md>), [programming](<https://devfeed.tech/tags/programming.md>), [solutions](<https://devfeed.tech/tags/solutions.md>), [time](<https://devfeed.tech/tags/time.md>)

### AI overview

This article presents high-level ideas and Kotlin solutions for Advent of Code 2021 tasks from days 13 to 15. It discusses folding a 2D array, modeling polymer growth with dynamic programming, and finding a shortest path in a 2D array.

### Source excerpt

Ideas and Solutions for Advent of Code 2021 in Kotlin -- Part 3/4 The third week of Advent of Code requires more time and even some competitive programming knowledge like dynamic programming and graph theory. In this article, I share some high-level ideas and my solutions if you need a hint or a few to get that gold star. Ideas and Solutions for tasks 1 to 6 can be found here, for tasks 7 to 12 -- here. Day 13: Transparent Origami The 2D array contains two types of symbols -- . and #. This array can be folded horizontally and vertically multiple times. When folding # symbols replace . symbols, but not vice versa. Here is the complete task. This is a modeling task, which you can do on the 2D array itself, but the possible range is quite large, so you can hit a memory limit. The smarter solution would be to fold the # symbols (the initial input, actually). Such folding can be done with Kotlin's fold function using the initial value of # symbol positions and mapNotNull, which mirrors X or Y coordinates depending on the fold direction. Here is my solution. Day 14: Extended Polymerization We get the initial string (template) consisting of uppercase letters, which describe the initial state of the polymer. The list of pair insertion rules allows growing the initial polymer step by step exponentially. We need to model this growth during 10 (first sub-task) and 40 (second sub-task) steps. Here is the complete task. The first sub-task can be solved just by modeling, but even 20 steps are too long and require too much memory and time. The (much) better solution is based on dynamic programming. You can easily see that every pair grows independently of others (new elements are always added inside the pair). It means that the solution can be found for each pair separately and then combined. It doesn't speed up things sufficiently though. But makes the solution easier? Yes. Now, let's grow each pair step by step. So at each step, every pair (usually) produces two more pairs, which h

## HackerEarth Streak: An exciting data about your HackerEarth activity

DevFeed: [HackerEarth Streak: An exciting data about your HackerEarth activity](<https://devfeed.tech/articles/hackerearth-streak-an-exciting-data-about-your-hackerearth-activity-19991.md>)

Original publisher: [Read original article](<http://engineering.hackerearth.com/2014/06/18/hackerearth-streak-an-exciting-data-about-your-hackerearth-activity/>)

Published: 2014-06-18T00:00:00Z

Content type: tutorial

Language: en

Sources: [HackerEarth](<https://devfeed.tech/sources/hackerearth.md>)

Topics: [competitive-programming](<https://devfeed.tech/topics/competitive-programming.md>), [Data analysis](<https://devfeed.tech/topics/data-analysis.md>), [Algorithms](<https://devfeed.tech/topics/algorithms.md>), [structure](<https://devfeed.tech/topics/structure.md>)

Tags: [algorithm](<https://devfeed.tech/tags/algorithm.md>), [array](<https://devfeed.tech/tags/array.md>), [boolean](<https://devfeed.tech/tags/boolean.md>), [code](<https://devfeed.tech/tags/code.md>), [data](<https://devfeed.tech/tags/data.md>), [data-structure](<https://devfeed.tech/tags/data-structure.md>), [dynamic-programming](<https://devfeed.tech/tags/dynamic-programming.md>), [hash](<https://devfeed.tech/tags/hash.md>), [hashing](<https://devfeed.tech/tags/hashing.md>), [id](<https://devfeed.tech/tags/id.md>), [linear](<https://devfeed.tech/tags/linear.md>), [max](<https://devfeed.tech/tags/max.md>), [optimize](<https://devfeed.tech/tags/optimize.md>), [programming](<https://devfeed.tech/tags/programming.md>), [submission](<https://devfeed.tech/tags/submission.md>), [type](<https://devfeed.tech/tags/type.md>), [unique](<https://devfeed.tech/tags/unique.md>)

### AI overview

HackerEarth calculates Code Streak as the maximum number of unique problems solved across consecutive correct-submission ranges, identifying each problem by both type and ID. It uses hashing to avoid counting a problem more than once; the linear dynamic programming approach used in a simplified challenge does not fit the unrestricted ID range described here. Day Streak is the longest run of dates on which a user solved a new problem. The method reuses submission data, adds each submission's date, and traverses sorted submissions alongside precomputed dates for the current century, marking days with newly solved problems before finding the longest run. The author says this avoids querying submissions separately for every day, though the algorithm still depends heavily on the number of submissions per day, and suggests hashing may be further optimized.

### Source excerpt

We have been constantly adding features to our HackerEarth Developer Profile, making it better with every new update. One of the exciting data in it is HackerEarth Streak on the HackerEarth Activity page. This post explains how we process user data and compute such results. We split it into two parts: Code Streak: Maximum number of unique problems solved continuously Day Streak: Maximum number of days such that one new problem is solved each day Code Streak: Extracting Relevant Data All we have is the data about all the submissions made by any user. In order to process Code Streak we need to identify two things. To which problem the submission was made to? Now we have several different types of Problems in Challenges and Practice Problem. For eg: Programming Problem, Approximate Problem, Golf Problem etc. Each problem is assigned two attributes. Type (Programming Problem, Approximate Problem, Golf Problem etc) and ID (1,2,3 and so on). So in order to uniquely identify any problem we need both the attributes, because a Programming Problem can have the same ID as Approximate Problem, the difference is in the Type. Was the submission graded Correct or Incorrect? This is directly accessible from a single boolean attribute Solved which is True if Correct and False if Incorrect. Now that we have extracted the data enough to calculate Code Streak, we move to the Data Structure part. Solution - The Data Structure behind Recently there was a question inspired from Code Streak in June Easy Challenge as Roy and Code Streak. It was simplified and ID ranges were restricted to convert the problem into easier one. A linear DP (Dynamic Programming) solution was enough to solve the problem. Algorithm steps are as follows: Find all the ranges of Correct submissions For each range, count all the unique problems which have never been solved before Store the count in an array Find the maximum from the array The second point is the challenge here. How do we know whether the problem with

## Solving Every Sudoku Puzzle

DevFeed: [Solving Every Sudoku Puzzle](<https://devfeed.tech/articles/solving-every-sudoku-puzzle-40588.md>)

Original publisher: [Read original article](<http://norvig.com/sudoku.html>)

Published: 2006-05-25T00:00:00Z

Content type: tutorial

Language: en

Sources: [Peter Norvig](<https://devfeed.tech/sources/peter-norvig.md>)

Topics: [Python](<https://devfeed.tech/topics/python.md>), [competitive-programming](<https://devfeed.tech/topics/competitive-programming.md>), [Test-driven development](<https://devfeed.tech/topics/tdd.md>)

Tags: [algorithm](<https://devfeed.tech/tags/algorithm.md>), [code](<https://devfeed.tech/tags/code.md>), [constraint](<https://devfeed.tech/tags/constraint.md>), [data-structure](<https://devfeed.tech/tags/data-structure.md>), [depth-first-search](<https://devfeed.tech/tags/depth-first-search.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [puzzle](<https://devfeed.tech/tags/puzzle.md>), [python](<https://devfeed.tech/tags/python.md>), [solve](<https://devfeed.tech/tags/solve.md>)

### AI overview

The solver models each Sudoku square by its remaining possible digits and uses constraint propagation to eliminate impossible choices. When propagation stalls, it applies recursive depth-first search, choosing the square with the fewest possibilities and trying its digits in numeric order. The article reports solving its tested easy, hard, and hardest puzzle sets quickly, while random puzzles reveal highly variable runtimes: a few take far longer, and some generated puzzles have multiple solutions or none. The author notes that search ordering affects runtime and that further experiments would be needed to characterize difficult puzzles.

### Source excerpt

Python code and an explanation of how to solve any Sudoku puzzle.