**We can disagree and still be friends.**
I build bridges and tools for others to use.
I maintain and improve a lot of legacy code, monoliths, services.
I spend my free dev-time on FOSS packages.
Did you test your solution? You didn't. If you did, you would be surprised to find out you are missing a return statement.
Don't get me wrong, I'm not scalding you. I'm trying to give you a valuable advice.
Learn to write tests as you learn to write code. It will make you a much better programmer. Trust me.
**We can disagree and still be friends.**
I build bridges and tools for others to use.
I maintain and improve a lot of legacy code, monoliths, services.
I spend my free dev-time on FOSS packages.
My bad... "Find and print"... the task is flawed 🤷♂️
Anyway, much better to write console.log(solve(...)) and return a result than print within the working function and retun nothing.
Did you test your solution? You didn't. If you did, you would be surprised to find out you are missing a
returnstatement.Don't get me wrong, I'm not scalding you. I'm trying to give you a valuable advice.
Learn to write tests as you learn to write code. It will make you a much better programmer. Trust me.
My bad... "Find and print"... the task is flawed 🤷♂️
Anyway, much better to write
console.log(solve(...))and return a result than print within the working function and retun nothing.It passed all the test cases provided by HackerRank. And ya thanks for your advice. It'll help me in the future for sure.