We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent aa2d857 commit 37f28e3Copy full SHA for 37f28e3
Move_Zeroes/SimpleSolution.py
@@ -0,0 +1,19 @@
1
+##==================================
2
+## Leetcode
3
+## Student: Vandit Jyotindra Gajjar
4
+## Year: 2020
5
+## Problem: 283
6
+## Problem Name: Move Zeroes
7
+##===================================
8
+#Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements.
9
+#
10
+#Example:
11
12
+#Input: [0,1,0,3,12]
13
+#Output: [1,3,12,0,0]
14
+class Solution:
15
+ def moveZeroes(self, nums):
16
+ zero = nums.count(0) #Count the number of zero in given array.
17
+ for i in range(zero):
18
+ nums.remove(0) #This will remove zero.
19
+ nums.append(0) #This will append zero at the end of list.
0 commit comments