Senior Php Developer Interview Questions

769 senior php developer interview questions shared by candidates

Q. Write a console PHP code using Standard Input / Output for the following problem: Given N numbers, [N<=10^5] we need to count the total pairs of numbers that have a difference of K. [K>0 and K<1e9]. Input Format: 1st line contains N & K (integers). 2nd line contains N numbers of the set. All the N numbers are assured to be distinct. Output Format: One integer saying the no of pairs of numbers that have a diff K. Sample Input #00: 5 2 1 5 3 4 2 Sample Output #00: 3 Sample Input #01: 10 1 363374326 364147530 61825163 1073065718 1281246024 1399469912 428047635 491595254 879792181 1069262793 Sample Output #01: 0
avatar

Senior PHP Developer

Interviewed at Sam Media

3.9
Mar 17, 2015

Q. Write a console PHP code using Standard Input / Output for the following problem: Given N numbers, [N<=10^5] we need to count the total pairs of numbers that have a difference of K. [K>0 and K<1e9]. Input Format: 1st line contains N & K (integers). 2nd line contains N numbers of the set. All the N numbers are assured to be distinct. Output Format: One integer saying the no of pairs of numbers that have a diff K. Sample Input #00: 5 2 1 5 3 4 2 Sample Output #00: 3 Sample Input #01: 10 1 363374326 364147530 61825163 1073065718 1281246024 1399469912 428047635 491595254 879792181 1069262793 Sample Output #01: 0

Viewing 141 - 150 interview questions

Glassdoor has 769 interview questions and reports from Senior php developer interviews. Prepare for your interview. Get hired. Love your job.