← Ripple Interview Insights

Ripple·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

Did a technical phone screen for a Software Engineer role at Ripple. One tree problem, but the follow-ups kept it interesting longer than I expected.

Questions Asked (3)

Q1

Given a binary tree and two target nodes, return the path between them as an ordered list of node values.

Algorithms & Data Structures
Author's notes

My first instinct was to find the path from root to each node, then stitch them together at the lowest common ancestor.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, find the lowest common ancestor (LCA) of the two target nodes. Then, collect the path from the first node up to the LCA and from the second node up to the LCA, and combine them appropriately to form the ordered path between the two nodes.

Pro tip: Clarify whether the path should include both target nodes and whether the tree is binary search tree or general binary tree; handling edge cases like when one node is an ancestor of the other shows thoroughness.

1. Clarify requirements and edge cases

Confirm if the path includes both target nodes, if the tree is a BST or general binary tree, and how to handle cases where a node is not present or one is ancestor of the other.

2. Find the lowest common ancestor (LCA)

Implement a function to find the LCA of the two nodes. This can be done recursively by checking if the nodes are in left or right subtrees.

3. Collect paths from each node to LCA

Traverse from each target node up to the LCA, storing the node values in lists. For the first node, the path will be from node to LCA; for the second, from node to LCA.

4. Combine paths to form the final ordered path

Reverse the path from the first node (so it goes from LCA to first node) and append the path from the second node (from LCA to second node), ensuring the LCA is included only once.

5. Handle edge cases and verify

Check if one node is ancestor of the other, if nodes are same, or if either node is missing. Test with simple examples to ensure correctness.

Key Points to Mention

  • Lowest Common Ancestor (LCA) concept and its role in finding the path.
  • Time complexity: O(n) for finding LCA and collecting paths, where n is number of nodes.
  • Space complexity: O(h) for recursion stack and O(path length) for storing paths.
  • Handling cases where one node is an ancestor of the other (path is direct).
  • Ensuring the path is ordered from first target node to second target node.
  • Edge cases: nodes not present, same node, skewed tree.

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

Q2

If the tree can contain duplicate values, how does your approach change and what should you use to identify the two target nodes?

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

They asked this right after I said I'd take values as input.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Acknowledge that duplicate values complicate node identification because value alone is insufficient. Explain that you would use unique node identifiers (e.g., object references or indices) to distinguish nodes, and adapt the algorithm to handle duplicates by tracking visited nodes or using a multi-pass approach. Emphasize that the core logic remains similar but requires careful handling of equal values.

Pro tip: Mention that in real-world systems, duplicates often require a tie-breaking rule or additional metadata; showing awareness of this trade-off demonstrates maturity beyond textbook solutions.

1. Clarify the problem and constraints

Ask whether the tree is a binary search tree (BST) or a general binary tree, and whether duplicates are allowed on both sides or have a specific ordering rule. This determines if value-based search is still viable.

2. Identify nodes uniquely

Explain that with duplicates, you cannot rely solely on node values. Use unique identifiers such as memory addresses (object references) or assign unique IDs during traversal to distinguish nodes.

3. Adapt the algorithm

If the original approach used value comparisons (e.g., finding two nodes that sum to a target), modify it to handle multiple candidates. For example, collect all nodes with a given value and then disambiguate using additional criteria.

4. Handle edge cases

Discuss scenarios like all nodes having the same value, or the two target nodes being duplicates of each other. Ensure your approach correctly identifies the specific nodes, not just values.

5. Analyze trade-offs

Compare approaches: using references adds memory overhead but ensures correctness; using indices requires a consistent traversal order. Mention time/space complexity implications.

Key Points to Mention

  • Duplicate values break value-based uniqueness; need unique node identifiers.
  • Use object references (e.g., in Java/Python) or assign unique IDs during traversal.
  • If BST with duplicates, define a consistent insertion rule (e.g., left <= root < right) to enable search.
  • For general binary trees, consider collecting all nodes and filtering by additional properties.
  • Edge cases: all nodes same value, target nodes are duplicates, or one is ancestor of the other.
  • Trade-offs: memory vs. correctness, and impact on time complexity.

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

Q3

If the tree is a BST, does the algorithm change, and how does the time complexity compare to a general binary tree?

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

This one I actually liked.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First clarify which algorithm the interviewer is referring to, as the impact of BST properties varies. Then explain how the BST property can be exploited to improve time complexity, typically from O(n) to O(log n) for search-like operations, while noting that some algorithms remain unchanged. Finally, discuss trade-offs and edge cases.

Pro tip: Mention that while BSTs improve average-case complexity, they can degrade to O(n) if unbalanced, so balanced trees like AVL or Red-Black are often used in practice. This shows awareness of real-world considerations.

1. Clarify the algorithm

Ask the interviewer to specify which algorithm they mean (e.g., search, insertion, deletion, traversal, validation). This ensures you address the correct context.

2. Explain BST properties

Briefly state that in a BST, for any node, all keys in the left subtree are smaller and all keys in the right subtree are larger. This ordering enables efficient operations.

3. Compare time complexities

For search/insert/delete: general binary tree O(n) vs BST O(h) where h is height, which is O(log n) if balanced, O(n) if skewed. For traversals: both O(n).

4. Discuss algorithm changes

Explain how the algorithm changes: e.g., search can prune subtrees based on comparisons, insertion maintains order, deletion handles cases like two children. Some algorithms like inorder traversal remain the same but yield sorted order in BST.

5. Address edge cases and trade-offs

Mention that BSTs require additional invariants to maintain, and unbalanced BSTs degrade to linked list performance. Also note that if the tree is not balanced, self-balancing trees are preferred.

Key Points to Mention

  • BST property: left < root < right
  • Time complexity: O(n) for general binary tree, O(log n) for balanced BST, O(n) for skewed BST
  • Search/insert/delete algorithms leverage comparisons to choose subtrees
  • Traversal algorithms (inorder, preorder, postorder) have same O(n) complexity but inorder gives sorted order in BST
  • Validation of BST requires checking bounds, not just local comparisons
  • Self-balancing trees (AVL, Red-Black) maintain O(log n) guarantees

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