← Oracle Interview Insights

Oracle·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Apr 2026

Summary

Oracle SWE coding round, one problem the whole time. Involved some OOP design work plus array processing, which I wasn't expecting to be combined like that.

Questions Asked (1)

Q1

You're given a list of items with unit prices, a list of discounts keyed by item name, and a shopping list that may contain duplicates. Implement a ShoppingItem class that extends an abstract base class (using the parent's getter methods, not protected fields directly), then for each distinct item in the shopping list return a tuple of item name, discounted unit price, and total price. Results sorted by item name.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

The OOP part tripped me up more than the logic did.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the problem requirements and edge cases, then outline the class hierarchy and algorithm before coding. Emphasize using the abstract base class's getter methods to access data, and ensure the solution is efficient and handles duplicates correctly.

Pro tip: Demonstrate awareness of the open-closed principle by designing the abstract base class to be easily extendable, and mention that using getters instead of protected fields maintains encapsulation and allows future changes without breaking subclasses.

1. Clarify requirements and edge cases

Ask questions to confirm input formats, discount application rules, handling of missing discounts, and expected output format. Discuss edge cases like empty lists, duplicate items, and items without discounts.

2. Design class hierarchy

Define an abstract base class with getter methods for item name and unit price. Implement ShoppingItem that extends it, using the parent's getters to access data, ensuring encapsulation.

3. Outline algorithm

Explain how to aggregate quantities from the shopping list, apply discounts to unit prices, compute total prices, and sort results by item name. Use a hash map for efficient lookups.

4. Analyze complexity and trade-offs

Discuss time and space complexity (e.g., O(n + m) where n is shopping list size and m is distinct items). Mention trade-offs between using a map versus sorting, and how getters impact performance.

5. Code and test

Write clean, modular code with clear variable names. Walk through a test case to verify correctness, including duplicates and discounts.

Key Points to Mention

  • Use of abstract base class and getter methods to enforce encapsulation and follow OOP principles.
  • Efficient aggregation of duplicate items using a hash map (dictionary) to count quantities.
  • Application of discounts: discounted unit price = unit price * (1 - discount), handling missing discounts as zero.
  • Sorting results by item name, considering case sensitivity and locale if relevant.
  • Time and space complexity analysis, and potential optimizations.
  • Edge cases: empty inputs, items without discounts, negative discounts, and large datasets.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.