static int sum_of_differences(int arr[], int N)
{
// Stores the sum
int sum = 0;
int i, j, flag;
// Traverse the array
for(i = 0; i < N - 1; i++)
{
if (arr[i] < arr[i + 1])
{
flag = 0;
for(j = i + 1; j < N - 1; j++)
{
// If last element of the
// increasing sub-array is found
if (arr[j] >= arr[j + 1])
{
// Update sum
sum += (arr[j] - arr[i]);
i = j;
flag = 1;
break;
}
}
// If the last element of the array
// is reached
if (flag == 0 && arr[i] < arr[N - 1])
{
// Update sum
sum += (arr[N - 1] - arr[i]);
break;
}
}
}
// Return the sum
return sum;
}
{
// Stores the sum
int sum = 0;
int i, j, flag;
// Traverse the array
for(i = 0; i < N - 1; i++)
{
if (arr[i] < arr[i + 1])
{
flag = 0;
for(j = i + 1; j < N - 1; j++)
{
// If last element of the
// increasing sub-array is found
if (arr[j] >= arr[j + 1])
{
// Update sum
sum += (arr[j] - arr[i]);
i = j;
flag = 1;
break;
}
}
// If the last element of the array
// is reached
if (flag == 0 && arr[i] < arr[N - 1])
{
// Update sum
sum += (arr[N - 1] - arr[i]);
break;
}
}
}
// Return the sum
return sum;
}
INFOSYS & TCS NQT EXAM SOLUTION GROUP π
https://t.me/Coding_human
https://t.me/infosys_all_slots_lti_exam
β Share post in ur college Whatsapp grps.
https://t.me/Coding_human
https://t.me/infosys_all_slots_lti_exam
β Share post in ur college Whatsapp grps.
Verbal tcs
1)up to the mark
2)stand up for
3)all in all
4)found a blood
5)c
6)but my father
7)the car for
8)cheerful
9)unrepe
10)praise
11)stromy
12)ease
13)nar
1)up to the mark
2)stand up for
3)all in all
4)found a blood
5)c
6)but my father
7)the car for
8)cheerful
9)unrepe
10)praise
11)stromy
12)ease
13)nar
Verbal tcs
1)up to the mark
2)stand up for
3)all in all
4)found a blood
6)but my father
7)the car for
8)cheerful
9)unrepe
10)praise
11)strom
12. Ease
13 nar
14 . Fasti
15 dabc
16 .cadb
17 strategic
18. A rare
19 ca
21. A servey
22.sightning
23 goose.
24 marsh
1)up to the mark
2)stand up for
3)all in all
4)found a blood
6)but my father
7)the car for
8)cheerful
9)unrepe
10)praise
11)strom
12. Ease
13 nar
14 . Fasti
15 dabc
16 .cadb
17 strategic
18. A rare
19 ca
21. A servey
22.sightning
23 goose.
24 marsh
Reasoning
1)242
2)370
3)166
4)124
5)99
6) 380
7)uc
8)qf
9)ur
10)2,5 3
11)3,5,1
12.315
13 gs
14.13 j
15 father in law
https://t.me/Coding_human
1)242
2)370
3)166
4)124
5)99
6) 380
7)uc
8)qf
9)ur
10)2,5 3
11)3,5,1
12.315
13 gs
14.13 j
15 father in law
https://t.me/Coding_human
Wedding code TCS
https://t.me/Coding_human
https://t.me/Coding_human
INFOSYS & TCS NQT EXAM SOLUTION GROUP π
https://t.me/Coding_human
https://t.me/infosys_tcs_all_slots_exam
β Share post in ur college Whatsapp grps.
https://t.me/Coding_human
https://t.me/infosys_tcs_all_slots_exam
β Share post in ur college Whatsapp grps.
π₯Zebronics mouse and keyboard @ 299 graabb
https://amzn.to/3FV07EZ
π₯grab fast Zebronics mouse @ 92
Choose other seller
https://amzn.to/3nUVZPi
Join @DMAD_Discussion
https://amzn.to/3FV07EZ
π₯grab fast Zebronics mouse @ 92
Choose other seller
https://amzn.to/3nUVZPi
Join @DMAD_Discussion
Infosys result will be declared on 30th Jan.
Good luckπ
Good luckπ
Some important interview questions
I gave tr1
Joins in dbms
Difference between primary and unique key, primary and foreign key
Constraints in dbms
What is union and union all
Group by and order by clause
Difference between array and collection
Difference between switch and if
Oops concept
I gave tr1
Joins in dbms
Difference between primary and unique key, primary and foreign key
Constraints in dbms
What is union and union all
Group by and order by clause
Difference between array and collection
Difference between switch and if
Oops concept
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int[] array = new int[6];
int max = 0;
for (int i = 0; i < array.length; i++) {
array[i] = in.nextInt();
if (array[max] < array[i]) {
max = i;
}
}
int cities = in.nextInt();
System.out.println(max);
}
}
Java
ALT TAB Window Code
Telegram - https://t.me/Coding_human
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int[] array = new int[6];
int max = 0;
for (int i = 0; i < array.length; i++) {
array[i] = in.nextInt();
if (array[max] < array[i]) {
max = i;
}
}
int cities = in.nextInt();
System.out.println(max);
}
}
Java
ALT TAB Window Code
Telegram - https://t.me/Coding_human
Important notice guyzz
Stay away from Rippers
Don't pay anything to anybody.
We provide free material always.
Kisi Ko kuch bhi amount pay mat krnaa π
βΊοΈβ€οΈ
Stay away from Rippers
Don't pay anything to anybody.
We provide free material always.
Kisi Ko kuch bhi amount pay mat krnaa π
βΊοΈβ€οΈ
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws NumberFormatException, IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System .in));
int t=Integer.parseInt(br.readLine());
while(t-->0)
{
int n=Integer.parseInt(br.readLine());
String[] num_str=br.readLine().split(" ");
int[] num=new int[n];
int i;
for(i=0;i<n;i++)
{
num[i]=Integer.parseInt(num_str[i]);
}
@Coding_human
int pos=0;
int count=0;
if(n!=1)
{
while(true)
{
int step=num[pos];
int max=-1;
int max_ind=-1;
int limit;
if(step>n-pos-1)
{
count++;
break;
}
for(i=pos+1;i<=pos+step;i++)
{
if(max<num[i])
{
max=num[i];
max_ind=i;
}
}
//System.out.println("-"+max);
pos=max_ind;
count++;
}
}
else
{
count++;
}
System.out.println(count);
}
}
}
Java
β Energy drink code
πTelegram - https://t.me/Coding_human
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws NumberFormatException, IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System .in));
int t=Integer.parseInt(br.readLine());
while(t-->0)
{
int n=Integer.parseInt(br.readLine());
String[] num_str=br.readLine().split(" ");
int[] num=new int[n];
int i;
for(i=0;i<n;i++)
{
num[i]=Integer.parseInt(num_str[i]);
}
@Coding_human
int pos=0;
int count=0;
if(n!=1)
{
while(true)
{
int step=num[pos];
int max=-1;
int max_ind=-1;
int limit;
if(step>n-pos-1)
{
count++;
break;
}
for(i=pos+1;i<=pos+step;i++)
{
if(max<num[i])
{
max=num[i];
max_ind=i;
}
}
//System.out.println("-"+max);
pos=max_ind;
count++;
}
}
else
{
count++;
}
System.out.println(count);
}
}
}
Java
β Energy drink code
πTelegram - https://t.me/Coding_human
#include<stdio.h>
#include<math.h>
int isPerfectSquare(int number)
{
int iVar;
float fVar;
fVar=pow(number,1.0/3.0);
iVar=(int)fVar;
if(iVar==fVar)
return number;
else
return 0;
}
@Coding_human
int main()
{
int n;
scanf(β%dβ,&n);
int arr[n];
int i;
for(i = 0; i < n; i++)
{
scanf("%d",&arr[i]);
}
int count = 0;
for(i = 0; i < n; i++)
{
if(isPerfectSquare(arr[i]))
count++;
}
printf("%d",count);
return 0;
}
E-Commerce
Telegram - https://t.me/Coding_human
#include<math.h>
int isPerfectSquare(int number)
{
int iVar;
float fVar;
fVar=pow(number,1.0/3.0);
iVar=(int)fVar;
if(iVar==fVar)
return number;
else
return 0;
}
@Coding_human
int main()
{
int n;
scanf(β%dβ,&n);
int arr[n];
int i;
for(i = 0; i < n; i++)
{
scanf("%d",&arr[i]);
}
int count = 0;
for(i = 0; i < n; i++)
{
if(isPerfectSquare(arr[i]))
count++;
}
printf("%d",count);
return 0;
}
E-Commerce
Telegram - https://t.me/Coding_human