Skip to content

Conversation

@riyaa404
Copy link

@riyaa404 riyaa404 commented Aug 15, 2025

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

@riyaa404 riyaa404 changed the title Improved hint prompts with strict word limits Improved hint prompts with strict word limits Aug 18, 2025
@riyaa404 riyaa404 changed the title Improved hint prompts with strict word limits Improved hint prompts with strict word limits Aug 18, 2025
@decodingafterlife
Copy link
Owner

I think the advanced hint can be subtler; there is not much difference between it and the expert level hint. The order of the hints should be incremental, as the price for them is incremental. Maybe make the advanced hint more restrictive or change the expert level one so that it provides the basic algorithm...

@decodingafterlife
Copy link
Owner

@riyaa404 update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AI hint-Prompt needs an improvement

2 participants