- The interview was 45 minutes long.
- First 15 minutes he asked me about my background.
- I was provided a coderpad link to solve the coding problem.
- Why are you interested in this position
- What are your primary languages
- Rate yourself in Spark
- Rate yourself in Java
- What are threads
- How can you make threads talk to each other in Java
- How can you avoid race condition when you are dealing with threads in Java
Given an array of integers arr
and a number s
, write a function fourSum()
that finds index of those numbers in arr
that sum up to s
.
Your function should return an array of index of these numbers in an ascending order.
Input:
arr = [2, 7, 4, 0, 9, 5, 1, 3]
s = 20
Output:
[1, 2, 3, 4]
Explanation:
arr[1] + arr[2] + arr[3] + arr[4] = 7 + 4 + 0 + 9 = 20
- What is the time complexity of the program ?
- What is the space complexity of the program ?