Developer Intern Interview Questions

5,286 developer intern interview questions shared by candidates

Let's say a triple (a, b, c) is a zigzag if either a < b > c or a > b < c. Given an array of integers numbers, your task is to check all the triples of its consecutive elements for being a zigzag. More formally, your task is to construct an array of length numbers.length - 2, where the ith element of the output array equals 1 if the triple (numbers[i], numbers[i + 1], numbers[i + 2]) is a zigzag, and 0 otherwise. Example • For numbers = [1, 2, 1, 3, 4], the output should be solution(numbers) = [1, 1, 0]. o (numbers[0], numbers[1], numbers[2]) = (1, 2, 1) is a zigzag, because 1 < 2 > 1; o (numbers[1], numbers[2] , numbers[3]) = (2, 1, 3) is a zigzag, because 2 > 1 < 3; o (numbers[2], numbers[3] , numbers[4]) = (1, 3, 4) is not a zigzag, because 1 < 3 < 4; • For numbers = [1, 2, 3, 4], the output should be solution(numbers) = [0, 0]; Since all the elements of numbers are increasing, there are no zigzags. • For numbers = [1000000000, 1000000000, 1000000000], the output should be solution(numbers) = [0]. Since all the elements of numbers are the same, there are no zigzags.
avatar

Software Developer Intern

Interviewed at Robinhood

3.6
Sep 18, 2024

Let's say a triple (a, b, c) is a zigzag if either a < b > c or a > b < c. Given an array of integers numbers, your task is to check all the triples of its consecutive elements for being a zigzag. More formally, your task is to construct an array of length numbers.length - 2, where the ith element of the output array equals 1 if the triple (numbers[i], numbers[i + 1], numbers[i + 2]) is a zigzag, and 0 otherwise. Example • For numbers = [1, 2, 1, 3, 4], the output should be solution(numbers) = [1, 1, 0]. o (numbers[0], numbers[1], numbers[2]) = (1, 2, 1) is a zigzag, because 1 < 2 > 1; o (numbers[1], numbers[2] , numbers[3]) = (2, 1, 3) is a zigzag, because 2 > 1 < 3; o (numbers[2], numbers[3] , numbers[4]) = (1, 3, 4) is not a zigzag, because 1 < 3 < 4; • For numbers = [1, 2, 3, 4], the output should be solution(numbers) = [0, 0]; Since all the elements of numbers are increasing, there are no zigzags. • For numbers = [1000000000, 1000000000, 1000000000], the output should be solution(numbers) = [0]. Since all the elements of numbers are the same, there are no zigzags.

-can you tell us about yourself, introduce yourself and explain what you like -What kind of projects have you already worked on? -We will present the project to you and if you have any questions, please ask us afterwards
avatar

REMOTE Full-Stack Developer Intern

Interviewed at IBM

3.9
Aug 27, 2021

-can you tell us about yourself, introduce yourself and explain what you like -What kind of projects have you already worked on? -We will present the project to you and if you have any questions, please ask us afterwards

Viewing 561 - 570 interview questions

Glassdoor has 5,286 interview questions and reports from Developer intern interviews. Prepare for your interview. Get hired. Love your job.