Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static int isRapidlyIncreasing(int[] a)
- {
- if (a.Length == 1)
- return 1;
- int isRapidlyIncreasing = 1;
- for (int i = 1; i < a.Length; i++)
- {
- if (a[i] <= GetSumOfPreceedingElements(a, i) * 2)
- return 0;
- }
- return isRapidlyIncreasing;
- }
- public static int GetSumOfPreceedingElements(int[] a,int currentIndex)
- {
- int sum = 0;
- for (int i = 0; i < currentIndex; i++)
- {
- sum += a[i];
- }
- return sum;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement