InterviewBit Problems
Rearrange Array : Solved
About the Rearrange Array : Solved category
(1)
Very Simplest C++ Solution
(1)
2 lines Java Solution using ArrayList replaceAll() method
(1)
4 line code with A*n+B (A = Number to replace at A[i]and B = Old number at A[i]) ;)
(1)
Even declaring a very large array worked!
(2)
Another O(n) time and O(1) space approach
(1)
O(1) space complexity and O(n) time complexity simple solution
(1)
Easy C++ solution in O(1) space and in O(N) time
(1)
Mine approach is little different but easy to get: O(1)space
(1)
Why does this show wrong output
(1)
Tricky O(1) Space complexity | O(n) Time Complexity | C++
(4)
Alternate intuitive solution
(2)
Storing 2 values at same index O(1) space solution
(1)
Create a dynamic array and clear it
(3)
Doing a DFS from each element to find cycles. Marking of index done by negating them
(1)
Java solution o(n) space
(1)
Python in-place solution, use N*N does not overflow
(1)
Might be I am very dump to use this solution. BTW python approach here in O(1) space complexity
(1)
O(1) space complexity and O(n) time complexity
(1)
Totally a different approach... used loophole in interview bit comment
(3)
Partialy corrected
(1)
MY_Solution abc
(1)
C++ solution, passed all test cases
(2)
Rearrange Array Alternatively
(1)
Python Approach as suggested in Editorial
(1)
Working in C++ but not in python
(3)
My note of editorial approach
(1)
Bit manipulation approach
(1)
You need to store both values in same element and then work around
(1)
Simple solution (I watched a superman because of this)
(2)
next page →