Comparative Analysis of Styles in LLM-Generated Code for LeetCode Problems: A Preliminary Study

Yifan Zhang, Tsong Yueh Chen, Rubing Huang, Matthew Pike, Dave Towey, Zhihao Ying, Zhi Quan Zhou

Research output: Chapter in Book/Conference proceedingConference contributionpeer-review

Abstract

Large language models (LLMs) have rapidly become a powerful tool in automated code generation, yet most research has focused on their correctness and efficiency rather than the stylistic patterns of their outputs. In this preliminary study, we analyze the code patterns generated by five popular LLMs - ChatGPT, Gemini, Claude, Grok, and DeepSeek - in their free versions, across three LeetCode problems, one top-ranking each from the easy, medium, and hard categories. Our evaluation employs key metrics including inline comment density, naming conventions, and edge case handling, highlighting both similarities and differences in verbosity, comprehensibility, and robustness among the codes generated by models. The findings of this study have important implications for software engineering and education, suggesting that LLM-generated code can serve as both a tool for rapid prototyping and an effective learning resource for beginners. Our future work will extend this analysis to a broader set of coding challenges and compare LLM outputs with human-written code to develop robust criteria for evaluating automated code generation.

Original languageEnglish
Title of host publicationProceedings - 2025 IEEE 49th Annual Computers, Software, and Applications Conference, COMPSAC 2025
EditorsHossain Shahriar, Kazi Shafiul Alam, Hiroyuki Ohsaki, Stelvio Cimato, Miriam Capretz, Shamem Ahmed, Sheikh Iqbal Ahamed, AKM Jahangir Alam Majumder, Munirul Haque, Tomoki Yoshihisa, Alfredo Cuzzocrea, Michiharu Takemoto, Nazmus Sakib, Marwa Elsayed
PublisherInstitute of Electrical and Electronics Engineers Inc.
Pages1625-1630
Number of pages6
ISBN (Electronic)9798331574345
DOIs
Publication statusPublished - 2025
Event49th IEEE Annual Computers, Software, and Applications Conference, COMPSAC 2025 - Toronto, Canada
Duration: 8 Jul 202511 Jul 2025

Publication series

NameProceedings - 2025 IEEE 49th Annual Computers, Software, and Applications Conference, COMPSAC 2025

Conference

Conference49th IEEE Annual Computers, Software, and Applications Conference, COMPSAC 2025
Country/TerritoryCanada
CityToronto
Period8/07/2511/07/25

Keywords

  • Large language models
  • LeetCode problem
  • artificial intelligence
  • code generation
  • software engineering

ASJC Scopus subject areas

  • Computational Mathematics
  • Artificial Intelligence
  • Computer Networks and Communications
  • Computer Science Applications
  • Software
  • Media Technology

Fingerprint

Dive into the research topics of 'Comparative Analysis of Styles in LLM-Generated Code for LeetCode Problems: A Preliminary Study'. Together they form a unique fingerprint.

Cite this