Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static boolean almostIncreasingSequence(int[] sequence) {
- int count = 0;
- int mas [] = new int[sequence.length];
- for (int i =0; i < sequence.length-1; i++) {
- if (sequence[i] >= sequence[i + 1]) {
- mas[i] = sequence[i + 1];
- for (int y = 0; y < sequence.length-2; y ++){
- if (sequence[y]>=sequence[y+2]) {
- mas[y + 1] = sequence[y + 2];
- }
- }
- }
- }
- System.out.println(Arrays.toString(mas));
- for (int q =0; q < mas.length-1; q++) {
- if (mas[q] > 0) {
- count++;
- }
- }
- if (count>=2) {
- return false;
- }
- else {
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment