From 83e49c106c93d318bc0728760f6f154ab16f8862 Mon Sep 17 00:00:00 2001 From: tejasvicsr1 Date: Sat, 10 Oct 2020 16:31:29 +0530 Subject: [PATCH 1/3] Solution to issue #579 --- LeetCode/1480_Running_Sum_of_1d_array.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 LeetCode/1480_Running_Sum_of_1d_array.py diff --git a/LeetCode/1480_Running_Sum_of_1d_array.py b/LeetCode/1480_Running_Sum_of_1d_array.py new file mode 100644 index 0000000..1cc9a3f --- /dev/null +++ b/LeetCode/1480_Running_Sum_of_1d_array.py @@ -0,0 +1,7 @@ +class Solution: + def runningSum(self, nums: List[int]) -> List[int]: + ans = [] + ans.append(nums[0]) + for i in range(1, len(nums)): + ans.append(ans[i-1] + nums[i]) + return ans \ No newline at end of file From 5e618b61f082b0ae33943c26f24c80db219dd8a0 Mon Sep 17 00:00:00 2001 From: tejasvicsr1 Date: Sat, 10 Oct 2020 17:04:59 +0530 Subject: [PATCH 2/3] Solution to the problem 1470 #584 --- LeetCode/1470_Shuffle_the_array.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 LeetCode/1470_Shuffle_the_array.py diff --git a/LeetCode/1470_Shuffle_the_array.py b/LeetCode/1470_Shuffle_the_array.py new file mode 100644 index 0000000..bf93e11 --- /dev/null +++ b/LeetCode/1470_Shuffle_the_array.py @@ -0,0 +1,13 @@ +class Solution: + def shuffle(self, nums: List[int], n: int) -> List[int]: + ans = [] + j = 0 + k = n + for i in range(0, len(nums)): + if i%2 == 0: + ans.append(nums[j]) + j += 1 + else: + ans.append(nums[k]) + k += 1 + return ans \ No newline at end of file From 8feaafa27944b6ceccac88b89ebeb50d557b152a Mon Sep 17 00:00:00 2001 From: Tejasvi Chebrolu Date: Sat, 10 Oct 2020 17:13:37 +0530 Subject: [PATCH 3/3] Delete 1470_Shuffle_the_array.py --- LeetCode/1470_Shuffle_the_array.py | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 LeetCode/1470_Shuffle_the_array.py diff --git a/LeetCode/1470_Shuffle_the_array.py b/LeetCode/1470_Shuffle_the_array.py deleted file mode 100644 index bf93e11..0000000 --- a/LeetCode/1470_Shuffle_the_array.py +++ /dev/null @@ -1,13 +0,0 @@ -class Solution: - def shuffle(self, nums: List[int], n: int) -> List[int]: - ans = [] - j = 0 - k = n - for i in range(0, len(nums)): - if i%2 == 0: - ans.append(nums[j]) - j += 1 - else: - ans.append(nums[k]) - k += 1 - return ans \ No newline at end of file