1
Return

AdaptGen: A Problem-Adaptive Solution Template Generation Technique for Online Programming Platforms

delete2026-05-12
delete0
PRE
AI
G
Guowei Zhang
W
Weiqin Zou
X
Xiaowei Zhang
J
Jingxuan Zhang
J
Jifeng Xuan
DOI:10.1109/tse.2026.3692192delete
deleteOriginal
deleteOriginal request for help
deleteShare
deleteSave
Abstract

Abstract

En 中文
Online programming platforms that offer various programming tasks play a crucial role in helping programmers enhance their coding skills. Programming tasks posted for different application scenarios may follow the same or similar programming patterns in their solutions. This leads programmers to repeatedly write not just the core code of problem-solving, but also the same basic framework and some peripheral code (such as variable declarations and input/output handling) that are needed to make their solutions executable. Repeatedly writing boilerplate or well-mastered algorithmic frameworks wastes time and adds little value for programmers focused on skill-specific practice. Toward this, we propose to develop AdaptGen, a problem-adaptive code template generation method for online programming platforms. AdaptGen analyzes and extracts solution patterns from various programming problem solutions (i.e., code accepted by online programming platforms) and generates templates tailored to each problem. More specifically, AdaptGen is built on genetic programming and uses a linear hashing sequence encoding strategy to represent solutions. It incorporates selection, crossover, and de-duplication operators to maintain diversity in the evolution process, and a fitness function tailored to generate solution templates. These templates are then abstracted and structured with a flexible core-code-hiding mechanism, enabling programmers of different experience levels to practice efficiently. We evaluated AdaptGen using two datasets from LeetCode and NowCoder, containing a total of 997 tasks and over 3,200 solution categories. Results show that AdaptGen successfully generates usable templates for 77%-84% of solution categories, with 80% of the templates performing well in manual evaluations. It also outperforms seven advanced representative large language models (LLMs), achieving the best overall performance in template quality, consistency, and generation efficiency. To validate AdaptGen’s effectiveness in real-world programming environments, we further conduct a user study involving live coding practice by programmers in online programming platforms, which effectively demonstrated its utility in practical application scenarios.
Keywords:
Online programming platforms
solution template
adaptive generation
genetic algorithm

Journal

IEEE Transactions on Software Engineering cover
IEEE Transactions on Software Engineering
IF:
5.6
Papers:
2.8K
Citations:
1.1W

Organization

J
jinan inspur data technology co., ltd.
Scholars:
4
Papers: 2
Citations: 0
N
nanjing university of aeronautics and astronautics
Scholars:
2.4K
Papers: 860
Citations: 1
W
wuhan university
Scholars:
7.8W
Papers: 5.7W
Citations: 70
Cited Papers

Cited Papers

Citing Papers

Citing Papers