Skip to content

Commit 75de56e

Browse files
committed
Adding Simple Solution for Problem - 912 - Sort an Array
1 parent 0d4d31e commit 75de56e

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Sort_Array/SimpleSolution.py

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
##==================================
2+
## Leetcode
3+
## Student: Vandit Jyotindra Gajjar
4+
## Year: 2020
5+
## Problem: 912
6+
## Problem Name: Sort an Array
7+
##===================================
8+
#
9+
#Given an array of integers nums, sort the array in ascending order.
10+
#
11+
#Example 1:
12+
#
13+
#Input: nums = [5,2,3,1]
14+
#Output: [1,2,3,5]
15+
#
16+
#Example 2:
17+
#
18+
#Input: nums = [5,1,1,2,0,0]
19+
#Output: [0,0,1,1,2,5]
20+
class Solution:
21+
def sortArray(self, nums):
22+
nums.sort() #Using in-built method for sort in python to sort the array
23+
return nums #Returning array

0 commit comments

Comments
 (0)