7 552
订阅者
-524 小时
-327 天
-14730 天
帖子存档
TCS FREE CODING SOLUTIONS GROUP :
https://t.me/cod_solutions
TCS NQT FREE SOLUTIONS GROUP :
https://t.me/cod_solutions
Accenture Diva Exam mails out
Help available.
Contact : @mlcoder2
Attention everyone!!
It's time for TCS NQT😎
Those who've TCS Paid NQT exam should contact me immediately and book your slots.
Hopefully this is the last On-campus hiring for 2023 batch. Don't lose the opportunity guys.
We'll directly connect to your laptop to attempt the exam.
We'll provide all answers with best accuracy. Contact immediately.✌
Contact: @mlcoder2
Note : Each question has time limit(60-90 sec only) even each coding question also time limit.
import java.util.*;
public class Solution {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int arr[]=new int[n];
for(int i=0;i<n;i++)
arr[i]=sc.nextInt();
System.out.printf(myFun(arr)?"Yes":"No");
}
public static boolean myFun(int[] arr) {
int count = 0;
for (int i = 1; i < arr.length; i++)
{
if (arr[i] < arr[i - 1])
{
count++;
if (count > 1) {
return false;
}
if (i == 1 || arr[i] >= arr[i - 2])
{ arr[i - 1] = arr[i];
} else {
arr[i] = arr[i - 1]; }
}
} return true;
}
}
#java
