Time Complexity
Here, we have used two for loops, so total time complexity will be O(n²).
Space Complexity
Here, we have used only one array, other array is just for reference, so total space complexity will also be O(n).
— — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
Thanks for reading this article ❤
If this article helps you, please clap 👏 this article.
Please follow me on medium, I will post useful information like above.
Instagram → https://www.instagram.com/alexmurphyas8/
Twitter → https://twitter.com/AlexMurphyas8
If I got something wrong? Let me in the comments. I would love to improve.