Using reverse and map and then reduce again for this problem is actually awful though. This solution was awful as well. Both your and his suffer from the problem of not knowing the language well enough to know the proper tool for the job.
A library? You mean the language's native methods? Ya, why use those when you could spend 20min typing out a long imperitive-style solution that will run slower than just typing a single line of code. 🤦♂️
This comment is hidden because it contains spoiler information about the solution
Creating arrays using the Array constructor is discouraged
huh? This answer is wayyyy too convoluted and slow.
This comment is hidden because it contains spoiler information about the solution
This answer is terribly slow and overly convoluted. Not best practices at all.
Using reverse and map and then reduce again for this problem is actually awful though. This solution was awful as well. Both your and his suffer from the problem of not knowing the language well enough to know the proper tool for the job.
A library? You mean the language's native methods? Ya, why use those when you could spend 20min typing out a long imperitive-style solution that will run slower than just typing a single line of code. 🤦♂️