Beckham777

Untitled

May 7th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.81 KB | None | 0 0
  1. static boolean almostIncreasingSequence(int[] sequence) {
  2.        int count = 0;
  3.        int mas [] = new int[sequence.length];
  4.         for (int i =0; i < sequence.length-1; i++) {
  5.  
  6.             if (sequence[i] >= sequence[i + 1]) {
  7.                 mas[i] = sequence[i + 1];
  8.  
  9.                 for (int y = 0; y < sequence.length-2; y ++){
  10.                     if (sequence[y]>=sequence[y+2]) {
  11.                         mas[y + 1] = sequence[y + 2];
  12.                     }
  13.  
  14.                 }
  15.             }
  16.         }
  17.  
  18.        System.out.println(Arrays.toString(mas));
  19.        for (int q =0; q < mas.length-1; q++) {
  20.            if (mas[q] > 0) {
  21.                count++;
  22.            }
  23.        }
  24.         if (count>=2) {
  25.             return  false;
  26.         }
  27.         else {
  28.             return  true;
  29.        }
  30.     }
Advertisement
Add Comment
Please, Sign In to add comment