Transform your coding interview preparation with curated algorithm problems, auto-generated code templates, and instant test feedback.
User: 出算法题 / 刷题 / 练算法 / algo practice / 来一道题
The skill will:
User: 刷题
AI: [Asks for difficulty preference]
User: Medium
AI: [Generates problem with templates]
Read algo_history.md from the workspace root to track previously assigned problems and ensure no duplicates.
# Algorithm Practice History
| # | Problem Name | Difficulty | Category | Date |
|---|-------------|------------|----------|------|
| 1 | TwoSum | Easy | Array, Hash Table | 2026-03-27 |
Use the AskUserQuestion tool:
Question: "Which difficulty level would you like?"
Options:
Create an original algorithm problem with:
LongestSubstring, MergeIntervals)Arrays, Strings, Linked Lists, Trees, Graphs, Dynamic Programming, Greedy, Backtracking, Sorting, Searching, Stack/Queue, Hash Tables, Two Pointers, Sliding Window, Bit Manipulation, BFS/DFS, Divide & Conquer
java/.java import java.util.*;
public class <ProblemName> {
/**
* TODO: Implement your algorithm here
*
* <Brief description of function>
*
* @param <parameter description>
* @return <return value description>
*/
public <ReturnType> <methodName>(<Parameters>) {
// Write your code here
return <default value>;
}
public static void main(String[] args) {
<ProblemName> solution = new <ProblemName>();
int passed = 0;
int total = 0;
// Test Case 1: Normal case
total++;
<Type> result1 = solution.<methodName>(<input1>);
if (<check if result1 equals expected1>) {
System.out.println("Test Case " + total + ": ✅ Pass");
passed++;
} else {
System.out.println("Test Case " + total + ": ❌ Fail");
System.out.println(" Input: <input description>");
System.out.println(" Expected: <expected output>");
System.out.println(" Actual: " + result1);
}
// Test Case 2-N: Include edge cases (minimum 5 total)
// Must cover: normal cases, boundary cases, special cases
System.out.println("\nResults: " + passed + "/" + total + " Passed");
if (passed == total) {
System.out.println("🎉 All tests passed!");
} else {
System.out.println("💪 Keep trying! Review the failed cases above.");
}
}
}
python/.py from typing import List, Optional
class Solution:
def <method_name>(self, <parameters>) -> <return_type>:
"""
TODO: Implement your algorithm here
<Brief description of function>
Args:
<parameter description>
Returns:
<return value description>
"""
# Write your code here
pass
def main():
solution = Solution()
passed = 0
total = 0
# Test Case 1: Normal case
total += 1
result1 = solution.<method_name>(<input1>)
if result1 == <expected1>:
print(f"Test Case {total}: ✅ Pass")
passed += 1
else:
print(f"Test Case {total}: ❌ Fail")
print(f" Input: <input description>")
print(f" Expected: <expected output>")
print(f" Actual: {result1}")
# Test Case 2-N: Include edge cases (minimum 5 total)
# Must cover: normal cases, boundary cases, special cases
print(f"\nResults: {passed}/{total} Passed")
if passed == total:
print("🎉 All tests passed!")
else:
print("💪 Keep trying! Review the failed cases above.")
if __name__ == "__main__":
main()
Arrays.equals() for Java arrays, == for Python listsAppend the problem to algo_history.md in workspace root:
# Algorithm Practice History
| # | Problem Name | Difficulty | Category | Date |
|---|-------------|------------|----------|------|
| 1 | TwoSum | Easy | Array, Hash Table | 2026-03-27 |
| 2 | MergeIntervals | Medium | Array, Sorting | 2026-03-27 |
Auto-increment the sequence number and use current date.
Display the complete problem with:
java/.java python/.py algo_history.md for your journey# Java
cd java
javac <ProblemName>.java && java <ProblemName>
# Python
python python/<problem_name>.py
ValidParentheses)java/ and python/ directories if they don't existAfter using this skill, users should:
💡 Tip: This skill is perfect for daily algorithm practice. Try solving 1-2 problems per day to build strong problem-solving skills!
共 1 个版本