Problem 53960. Wordle

Wordle is an english game where you need to guess a 5 letter word. For each guess you'll receive a feedback for the placement of each letter. If a letter is in the correct spot it will show as green, if a letter is in the word, but in the wrong spot it will show as yellow and if the letter is not present in the word it will show as black.
For this problem your inputs will be the target word and a guess, the output should be a vector corresponding to the guess word where there should be a -1 if the letter is not present in the target word, a 0 if the letter is present in the target word, but at the wrong spot, and a 1 if the letter is in the correct spot.
Example:
Target Word: 'thing'
Guess Word: 'write'
Output: [-1 -1 1 0 -1]
All inputs will be lower case and contain 5 letters.
If a letter appears more than once in the guess and only once in the target word then it should be considered correct only once. consider the correct letter the one in the correct spot if any, else the first occurence of the letter should be considered (see test cases 2,3, and 4 for examples)

Solution Stats

44.44% Correct | 55.56% Incorrect
Last Solution submitted on Nov 14, 2024

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers8

Suggested Problems

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!