Improved hint prompts with strict word limits #32
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements the fixes of AI Hint Assistant. The following changes have been made:
Added three distinct prompt tiers:
Ordinary → short, basic guidance (~50 words).
Advanced → more detailed, step-by-step logic (~75 words).
Expert → in-depth strategy & optimization insights (~100 words).
The agent itself reply within that word limit.
Cleaned responses to show only the generated hint, removing extra text.
Resolved merge conflicts to ensure smooth integration with the latest main branch.
Testing :
Verified that each hint level follows word limits (50/75/100).
Checked the consistent across multiple problem (Ordinary < Advanced < Expert).
Prompt Testing Results Examples :
problem 1 tested: Two Sum
Temperature: 0.3 (set low for consistency)
Ordinary Hint (Max 50 words)
Hint :
Here's an Ordinary level hint... Consider using a data structure that can store and retrieve elements quickly, like a hash table or a dictionary. Think about how you can use this data structure to keep track of the numbers you've seen so far and their indices.
Word count: ~47 words
Advanced Hint (Max 75 words)
Hint :
Here's an Advanced level hint... This problem is a classic example of using a hash table. Iterate through the array and store each element. For each number, calculate its complement (target - current number) and check if it exists in the hash table. If it does, return the indices of the current number and its complement.
Word count: ~72 words
Expert Hint (Max 100 words)
Hint:
Here's an Expert level hint... Use a hash map to store the numbers you've seen so far and their indices. Iterate through the array, for each number, check if its complement (target - current number) exists in the hash map. If it does, return the indices of the current number and its complement. This approach has a time complexity of O(n) and a space complexity of O(n), making it more efficient than a brute force approach.
Word count: ~88 words
Problem 2 tested : Integer to Roman
Temperature: 0.3 (set low for consistency)
Ordinary Hint (Max 50 words)
Hint :
Here's Ordinary level hint... Start understanding the problem's constraints and rules for converting decimal place values to Roman numerals. Think how you can approach this problem using combination of loops and conditional statements. Consider breaking down the problem into smaller parts, such as converting tens, hundreds and thousands.
Word count: ~48 words
Advanced Hint (Max 75 words)
Hint :
Here's an Advanced level hint... To solve this problem, you can start by identifying the largest possible Roman numeral value that can be subtracted from the input number. This can be done by iterating through a list of Roman numeral values in descending order. Use a while loop to continuously subtract the largest possible value and append the corresponding Roman numeral symbol to the result.
Word count: ~66 words
Expert Hint (Max 100 words)
Hint :
Here's an Expert level hint... To solve this problem, you should first identify the largest Roman numeral value that is less than or equal to the given number. Then, subtract this value from the number and recursively convert the remaining value to a Roman numeral. This process continues until the number becomes 0. Use the subtractive forms (IV, IX, XL, XC, CD, CM) correctly and avoid appending the same symbol multiple times. Handle edge cases where the number is less than 4 or 9 separately.
Word count: ~99 words
Closes #15