Day3. Start Algorithm

This commit is contained in:
Electrominch
2022-10-05 00:44:15 +03:00
parent c9916dabad
commit 062e03bdbf
32 changed files with 446 additions and 57 deletions

View File

@@ -5,7 +5,7 @@
static void Main(string[] args)
{
Solution sol = new Solution();
sol.PivotIndex(new int[] { 1,4,2});
sol.PivotIndex(new int[] { 1, 4, 2 });
}
}
}

View File

@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _724._Find_Pivot_Index;
namespace _724._Find_Pivot_Index;
public class Solution
{
@@ -12,7 +6,7 @@ public class Solution
{
int[] sumsFromLeft = new int[nums.Length];
int[] sumsFromRight = new int[nums.Length];
for(int i = 1; i < nums.Length; i++)
for (int i = 1; i < nums.Length; i++)
sumsFromLeft[i] = nums[i - 1] + sumsFromLeft[i - 1];
for (int i = nums.Length - 2; i >= 0; i--)