I guess you must have found this ancient thread by searching, so continue your effort and search some more; you will find your answer has already been given here a few hundred times :-)
If you can't find it after trying for a while, post a new question according to the guidelines. (Hint: this question is not likely to get the answer you are seeking.)
The way forward always starts with a minimal test.
This code seems to bit complex with maps & sub calls in one line. this code is faster, my piece of code is slower and consuming more memory. You help is appreciated. TIA.