Back to course home
0% completed
Vote For New Content
my solution in python
Rahil Dhodapkar
Mar 1, 2025
class Solution:
def moveElements(self, arr):
write_idx = 1
curr_val = arr[0]
for read_idx in range(1, len(arr)):
if arr[read_idx] > curr_val:
curr_val = arr[read_idx]
arr[write_idx], arr[read_idx] = arr[read_idx], arr[write_idx]
write_idx += 1
return write_idx
0
0
Comments
Comments
On this page
Problem Statement
Try it yourself