 # Can anyone the help with the solving approach?

``````  **Your code so far**
``````
``````
function findLongestWordLength(str) {
return str.length;
}

findLongestWordLength("The quick brown fox jumped over the lazy dog");
``````

Challenge: Find the Longest Word in a String

It doesn’t look like you have tried anything yet. What part of the instructions do you need help understanding?

I am not able to figure out what technique to apply

How would you do this task with pencil and paper?

Can you understand it in pseudo code? Or if you had to explain to someone how to do this, step by step, assuming they were a child, how would you explain a fool proof process?

Like if the task were to find the lowest number in an array, I might explain it as:

1. Start at the beginning of the array and assume that the first number/ element is the lowest number.
2. Check the next number - if it is lower than the current “lowest number”, replace the current “lowest number” with that current element.
3. Go to the next number and repeat step 2, keep repeating until the list is done.
4. When you’ve finished the list, return your current “lowest number”.

Does that makes sense? Being able to break down a problem like that is very good for doing algorithms. Most of us if asked to do that task in the “real world” would just quickly scan the list and “know” what the answer is. But computers are dumb and are terrible at “intuitive” things, so you have to break it down to very simple instructions.

Can you do that for the problem you are facing?

3 Likes