software engineer internship interview questions shared by candidates
How work you work out all the prime numbers up to a given range?
Store all the prime numbers in an array and compare the next number with the array to find out whether it is prime or not.
Sieve of Eratosthenes algorithm. create an array of the numbers, set them all to the value 1. Start at 2, set every second number after 2 to 0. move to the next number (3). change every third number after three to zero. stop when there's no more numbers set to 1 or you reach the end of the array. At the end, the numbers marked 1 are the primes.
Interview candidate - did you give that answer in the interview? If so, what did they say?
write a function to check if two strings are substrings of each other (either first is substring of second or vice versa). write a function to check if two strings are anagrams of each other. The interview was 45 minutes and we didn't have time to code the seconds question so i discussed the two solutions and analyzed their time and space complexities.