Software Engineer Intern
9 Questions
Problem 1: Retrieve Missing Label Given an integer array labels, find the k-th smallest positive integer that is missing from the array. Example: labels = [1, 4, 7, 3, 4] k = 5 Missing numbers = 2, 5, 6, 8, 9 Output: 9
Problem 2: Pair of Triplets Given an array, form triplets as: (arr[i], arr[i+1], arr[i+2]) Count unordered pairs of triplets that differ in exactly one position. Example: arr = [3, 2, 2, 2, 3] Triplets: [3,2,2], [2,2,2], [2,2,3] Output: 2
Problem 3: Same Set Bits Count For a number n, define f(n) as the smallest number >= n with all bits = 1. Count how many numbers <= f(n), excluding n, have same number of set bits as n. Example: n = 6 (110) Numbers with 2 set bits: 3, 5, 6 Exclude 6 → Output: 2
Problem 4: Favorite Color Puzzle People: Jack, Matthew, Albert, Peter, Sebastian Clues: - Jack: red, not India/China - Albert: football, not yellow, not UK - Matthew: badminton, Russia - Peter & Sebastian: colors = yellow & green - Peter & Sebastian: countries = China & UK - India → brown - China → green - South Korea → squash - UK → volleyball Question: Whose favorite color is black? Answer: Matthew
Problem 5: Logical Progression Series: ABC, ABC2, AB2C2, A2B2C2 Find next term. Answer: A2B2C3
Problem 6: Distance After Movement P1 and P2 are 100m apart. P1: - 50m towards P2 - left 18m - left 50m P2: - 57m towards P1’s initial position Question: Final distance? Answer: 55 meters
Problem 7: Function Output func(int i){ if(i % 2) return 0; else return 1; } int main(){ int i = 3; i = func(i); i = func(i); printf("%d", i); } Output: 1
Problem 8: String and Pointer char * myFunc(char * ptr){ ptr += 3; return ptr; } int main(){ char *x, *y; x = "Hello"; y = myFunc(x); printf("y = %s", y); } Output: y = lo
Problem 9: Memory Allocation Holes: A = 304MB, B = 724MB, C = 540MB Requests: 300, 224, 520, 500 Question: Which allocation technique works? Answer: First Fit
Divyansh Garg·Mar 2026