Panda Guru LogoPanda
Guru

Oracle phone interview

Round 1

Questions:

Question 1

Given an array of n distinct integers, d = [d[0], d[1], …, d[n-1]], and an integer threshold, t, determine the number of (a, b, c) index triplets that satisfy both the conditions:

Example:

d = [1,2,3,4,5] t = 8

The following 4 triplets satisfy the constraints:

Function Description: Complete the function triplets in the editor below.

triplets has the following parameter(s):

Returns:

Constraints:

Question 2

Contiguous subarrays are a group of an uninterrupted range of elements from an array as they occur. No elements in the range can be skipped or reordered. Given an array of integers, numbers, and an integer k, determine the total number of subarrays of numbers that have a product that is less than or equal to k.

Example:

numbers = [2, 3, 4]

The subarrays are [[2], [3], [4], [2, 3], [3, 4], [2, 3, 4]]. The product of a subarray is the product of all of its elements so the products for the list of subarrays are [2, 3, 4, 6, 12, 24]. If k = 6, 4 subarrays satisfy the condition, [2], [3], [4], [2, 3].

Function Description: Complete the function count in the editor below.

count has the following parameter(s):

Returns:

Constraints:

Candidate's Approach

No approach provided.

Interviewer's Feedback

No feedback provided.