Oracle/SMTS/IC3

oracle logo
oracle
SMTS IC3
August 18, 202513 reads

Summary

I recently interviewed at Oracle for an SMTS IC3 role where I was asked a specific algorithmic problem called 'Biological Hazards' which involved analyzing bacteria interactions.

Full Experience

I recently had an interview at Oracle for an SMTS IC3 position. The interview revolved around a single, specific algorithmic problem. The problem, titled 'Biological Hazards', challenged me to analyze interactions between bacteria samples arranged in a row. The core task was to identify contiguous intervals where all bacteria could coexist without any being poisonous to another within that segment.

Interview Questions (1)

Q1
Biological Hazards
Data Structures & Algorithms

A biological researcher is studying bacteria interactions where certain bacteria are poisonous to others. The samples are arranged consecutively in a row, numbered from 1 to n.

You are given two integer arrays allergic and poisonous of equal length m, where:

  • poisonous[i] is poisonous to allergic[i].

Your task is to determine the number of contiguous intervals [l, r] within the row such that all bacteria in that interval are capable of coexisting (i.e., no bacterium in the interval is poisonous to another bacterium in the same interval).

Example 1

Input:

n = 3
allergic = [2, 1, 3]
poisonous = [3, 3, 1]

Output:

4

Explanation:

The bacteria are arranged as [1, 2, 3].

All possible intervals are: (1), (2), (3), (1,2), (2,3), (1,2,3).

Valid intervals are (1), (2), (3), (1,2).

Total valid intervals = 4

Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

Be the first to share your thoughts and start the discussion!