Given an array A[n], write a C program to find P and Q (P>Q) such that A[P] - A[Q] is maximum
AnswerBot
1y
C program to find P and Q (P>Q) such that A[P] - A[Q] is maximum
Iterate through array and keep track of maximum difference and corresponding indices
Initialize P and Q to first two elements and update ...read more
Anonymous
1mo
Sir I really hard work and growth your company business
Venkatesh Karthik
3mo
Maximum difference and minimum index
Kavya Narkuti
4mo
Max minimum
MANVEL M
4mo
After the loop, the values of P and Q represent the indices where A[P] - A[Q] is maximum, with P > Q.
punam kadam
4mo
Max minimum
Anonymous
4mo
23 minutes
Anonymous
5mo
Maximus and minimum
Susheela SUSHEELA
5mo
Maximum and minimum
Anonymous
5mo
Maximum
Anonymous
5mo
Maximum A(p)
Minimum A(Q)
Manoj Kumar sharma
5mo
Maximum & Maximum
subtlestarfish
5mo
works at
RAM SINGH CHAUHAN
This is the simple way but take a mind
subtlestarfish
5mo
works at
RAM SINGH CHAUHAN
Initialize two variables to keep track of the maximum difference and the indices π P and π Q. Iterate through the array while maintaining the minimum value found so far and its index. For each ele
Simran Pathan
6mo
Simply find the maximum element of the array as per procedure and catch that index in one variable. Same with the minimum element of the array. And then print the indexes of minimum and maximum number...read more
Ashwini Jolapuram
6mo
Maximum and minimum
Anonymous
6mo
C program to find p and q (p>q) such that A(p) -A(q) is macimumltere through arry and jeep track of maximum difference and corresponding indiceslnitialize p and 1 to first two elements and u
Anonymous
6mo
Minimum
Nisha Sushil Chavan
6mo
A(p) minimum
Anonymous
6mo
max-min
Farhan Mahbub
6mo
Initialize two variables to keep track of the maximum difference and the indices π P and π Q. Iterate through the array while maintaining the minimum value found so far and its index. For each element...read more
Anonymous
7mo
C=o
Venkatesan Gopalakrishnan
8mo
3 turns
ABHISHEK SHUKLA
8mo
C=O
Anonymous
9mo
Is c= 0
Bhulendra Patel
9mo
P
Shaik Bilal
9mo
A
Satveer Mahar
10mo
C=O
Sk Nadim
10mo
C program to find P and Q (P>Q) such that A(P)-A(Q) is maximum Iterate through array and keep track of maximum difference and corresponding indices Initialize P and Q to first two elements and updated...read more
Ganesh Chotugiri Gosavi
1y
This is the simple way but take a mind
Anonymous
1y
C program to find p and q (p>q) such that A(p) -A(q) is macimumltere through arry and jeep track of maximum difference and corresponding indiceslnitialize p and 1 to first two elements and u
Abhay H Kashyap
2y
I dont think the below solution will work because of the condition P>Q. the maximum element is present before the minimum element in the array then it will give the wrong answer.
Maintaing a variabl...read more
shafee ah
2y
this the simple way !! :)
shafee ah
2y
we can write two function
The first one - will find the where the maximue value in the array - then return the index of this item
The secound - will find the minum of the value of the array - then r...read more
Add answer anonymously...
Top Qualcomm Software Engineer interview questions & answers
Popular interview questions of Software Engineer
Top HR questions asked in Qualcomm Software Engineer
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app