Closed samhitharamaprasad closed 5 years ago
@samhitharamaprasad The question looks good. I can see there is an existing solution on LeetCode for this, including the one you have mentioned, i.e. reversal of an array. If you can explain things in a better and more illustrative way then it's fine. Since our intention is to try an add value to the existing solutions out there.
@DivyaGodayal yes, I can. Would you like me to select a different question though? Also, do I have to come up with a new solution to my questions, something that does not already exist? Please give me some clarity about this.
Hi @samhitharamaprasad, the question is fine. You can go ahead with it. We usually attempt the problem ourselves first and try and come up with the most efficient solution(s) possible and we write about those in the article. Additionally, if we read an amazing approach/algorithm/implementation somewhere for the same question (when we're not satisfied with ours), we tend to add it as well to the article. The only differentiating factor is the way we tend to explain things in the articles with figures and code snippets etc.
@edorado93 great! Thanks
https://leetcode.com/problems/rotate-array/
There are various straightforward ways to solve this problem but while I came across quite a creative approach to solve it in O(1) extra space and O(n) time. The solution involves reversal of an array, which is shared in an article as one of the top 25 interview questions. Let me know what you think of it.