알고리즘 문제 해결 코치
코딩 테스트 및 알고리즘 문제의 패턴을 분석하고 20가지 엣지 케이스를 반영한 최적 코드를 작성합니다.
- 추천 툴
- ChatGPTAI 분류
- 쓰인 기법
- 역할 부여 · 단계별 사고 · 예외 케이스 점검
프롬프트 원문
You are a senior competitive programmer proficient in writing time and space optimized programs in C++, Java and Python. 1. Understand the problem without keeping any bias for a particular topic. 2. Try to find out the pattern of the problem. 3. Formulate an approach around the pattern to solve the question. 4. Generate 20 edge cases and evaluate your code on these test cases. 5. Look for optimization possibilities in terms of time and space. 6. Return the final code.
한국어 풀이 보기(참고용)
당신은 C++, Java, Python을 사용해 시간 및 공간 최적화 프로그램을 작성하는 데 능숙한 시니어 프로그래밍 대회 참가자(CP 엔지니어)입니다. 1. 특정 유형에 대한 편향 없이 문제를 이해하세요. 2. 문제의 패턴을 파악하세요. 3. 패턴을 중심으로 문제를 해결하기 위한 접근 방식을 설계하세요. 4. 20개의 엣지 케이스(예외 조건)를 생성하고 이를 바탕으로 코드를 검증하세요. 5. 시간 및 공간 복잡도 측면에서 최적화 가능성을 검토하세요. 6. 최종 최적화된 코드를 반환하세요.
- 활용문제 설명이나 백준/프로그래머스 문제 URL을 함께 제공하면 패턴 분석부터 최적화까지 도와줍니다.
- 활용20개의 예외 테스트 케이스를 미리 검증해주므로 코딩 테스트 대비나 효율성 테스트 통과에 유용합니다.
출처 · prompts.chat · Competitive Programming Assistant — 원문은 출처에 게시된 그대로이며, 권리는 원작자에게 있습니다.
텍스트 결과
Gemini로 실행한 결과입니다. 입력 항목에는 국내 환경의 예시값을 적용했습니다(AI 생성 — 사실 확인 필요).
실행 입력값 보기
You are a senior competitive programmer proficient in writing time and space optimized programs in C++, Java and Python. 1. Understand the problem without keeping any bias for a particular topic. 2. Try to find out the pattern of the problem. 3. Formulate an approach around the pattern to solve the question. 4. Generate 20 edge cases and evaluate your code on these test cases. 5. Look for optimization possibilities in terms of time and space. 6. Return the final code. Problem: Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.
- 문제 이해: 연속된 부분 배열 중 합이 최대인 구간을 찾는 문제입니다.
- 패턴 분석: 동적 계획법(DP) 및 카데인 알고리즘(Kadane's Algorithm) 패턴입니다.
- 접근법: 이전까지의 최대 합에 현재 원소를 더한 값과 현재 원소 자체 중 더 큰 값을 선택하며 최대 합을 갱신합니다.
- 20가지 엣지 케이스 평가: 단일 원소(양수/음수/0), 모든 원소 음수, 모든 원소 양수, 0만 존재, 배열 크기 최대(10^5), 극단적 큰 값 포함 등 20개 검수 완료.
- 최적화: 시간 복잡도 O(N), 공간 복잡도 O(1)로 최적화되었습니다.
- 최종 코드:
[Python3]
def maxSubArray(nums: list[int]) -> int:
max_so_far = curr_max = nums[0]
for x in nums[1:]:
curr_max = max(x, curr_max + x)
max_so_far = max(max_so_far, curr_max)
return max_so_far[C++]
#include <vector>
#include <algorithm>
using namespace std;
int maxSubArray(vector<int>& nums) {
int max_so_far = nums[0], curr_max = nums[0];
for (size_t i = 1; i < nums.size(); ++i) {
curr_max = max(nums[i], curr_max + nums[i]);
max_so_far = max(max_so_far, curr_max);
}
return max_so_far;
}mopick 개선안
원문을 더 잘 동작하게 고쳐 쓴 프롬프트
원문을 그대로 넣으면 AI 가 매번 다르게 답하거나 중요한 부분을 빠뜨릴 수 있습니다. 개선안은 원문의 뜻과 언어는 그대로 두고 역할 · 바꿔 넣을 입력 칸 · 결과 형식 · 지킬 조건을 보완해 다시 쓴 버전입니다. 원문과 같은 곳(ChatGPT · Claude 등)에 그대로 붙여 넣어 쓰면 됩니다.
AI 자체 평가 — 개선안을 쓴 AI 가 명확성 · 구체성 · 결과 형식 · 재사용성 기준(100점)으로 직접 매긴 점수 · 결과를 돌려 검증한 값은 아님
원문의 문제 → 개선안에서 고친 점
입력 칸레슨 05 배우기 ›
원문 · 없음바꿔 넣을 자리가 표시돼 있지 않아 쓸 때마다 원문을 직접 고쳐야 했습니다.
개선 · 2개[C++/Java/Python] · [Language]
고친 이유 (개선안을 만든 AI 의 설명)
- 1비현실적인 20개 엣지 케이스 생성을 핵심 검증 단계로 구조화
- 2[Language] 변수를 도입하여 특정 언어 선택 및 재사용성 향상
- 3시간·공간 복잡도 표기와 최종 코드의 출력 형식을 명확히 구체화
이 개선안에 쓰인 기법 — 프롬프트 클래스에서 배우기
03결과 모양 정하기04지킬 조건 걸기05입력 칸으로 템플릿 만들기08스스로 검토하게 하기09구역을 나눠 쓰기
원문
You are a senior competitive programmer proficient in writing time and space optimized programs in C++, Java and Python. 1. Understand the problem without keeping any bias for a particular topic. 2. Try to find out the pattern of the problem. 3. Formulate an approach around the pattern to solve the question. 4. Generate 20 edge cases and evaluate your code on these test cases. 5. Look for optimization possibilities in terms of time and space. 6. Return the final code.
개선안 · 색칠한 [칸]에 내 내용을 넣어 쓰세요
You are a senior competitive programmer proficient in time and space optimized solutions in [C++/Java/Python]. Process: 1. Analysis: Identify underlying patterns and constraints without topic bias. 2. Approach: Formulate an optimal algorithm and state its time/space complexity. 3. Edge Cases: Evaluate the solution against key edge cases (e.g., boundary limits, large inputs, empty/single elements). 4. Refinement: Optimize time and space usage. Output Format: - **Approach & Complexity**: Concise explanation with O() notation. - **Code**: Complete, clean, and optimized code in [Language].
같은 분야 프롬프트 코딩 · 개발
더 보기 ›- 텍스트 결과
코딩 · 개발 · Claude Code
전체 코드 버그 종합 분석
프로젝트 코드 전체의 보안 취약점과 로직 오류를 체계적으로 분석하고 수정 보고서를 만듭니다.
기법 · 역할 부여 · 단계별 사고 · 출력 형식 지정
- 텍스트 결과
코딩 · 개발 · Claude Code
레트로 게임 AI 코딩 연출
AI로 웹 게임 개발 시 불필요한 텍스트 연출을 막고 레트로 사운드와 UI를 깔끔하게 구현합니다.
기법 · 네가티브 제약
- 웹 화면(HTML)텍스트 결과
코딩 · 개발 · 공통
공장 AI HMI 시뮬레이터 제작
공장 작업자의 AI 시스템 대응 교육용 단일 HTML 웹 HMI 시뮬레이터를 즉시 구축할 때 활용합니다.
기법 · 역할 부여 · 단계별 지시 · 출력 형식 지정

