<aside> <img src="/icons/light-bulb_gray.svg" alt="/icons/light-bulb_gray.svg" width="40px" />
Help : If you want be great in problem solving read this book Gerogy Polya Strategy
or you can read this summary here
</aside>
Coming up with examples can help you understand the problem better and reveal hidden cases.
"hello"
→ {h:1, e:1, l:2, o:1}
"mississippi"
→ {m:1, i:4, s:4, p:2}
""
→ {}
null
or 123
→ Decide how your program should handle these.Explicitly write out the steps needed to solve the problem.
If you need to make an object, write:
“Make an empty object to store results.”
If you need to use a loop, write:
“Create loop for each character in the string.”
If there are steps inside the loop, write them clearly:
“Check if character exists in the object → update count or set to 1.”