D.E. Shaw Interview Experience | SMTS | oct 2024 | Reject
Anonymous User
3324

Current Position: SDE-II
Current Company: Banking MNC
Experience: Python Developer with 4.5 years of experience
College: Tier-2

Online Assessment
HackerRank

Programming Questions: 3 questions focusing on Data Structures and Algorithms (DSA). Topics include dynamic programming, graphs, and tree DP.

Round 1: Data Structures and Algorithms (1 hour 15 min)

  • DSA Problem 1: Find all the articulation points in a graph.

  • DSA Problem 2: Partition an array into two subsets such that the absolute difference between the sums of the subsets is minimized.

  • problem 3:

class MyInt(int):
    def __new__(cls, value):
        print(f"Creating MyInt({value})")
        return super().__new__(cls, value)
    
    def __eq__(self, other):
        print("Checking equality")
        if isinstance(other, MyInt):
            return super().__eq__(other) and self.real == other.real
        return False
    
    def __hash__(self):
        print("Calculating hash")
        return super().__hash__()

a = MyInt(10)
b = MyInt(10)

print(a == b)
print(hash(a) == hash(b))
  1. Explain the purpose of each method in MyInt.
  2. What will be the output of the code above?
  3. Modify the MyInt class to make a == b return False
    and hash(a) == hash(b) return True
    without modifying any part of the code that follows the class definition.

Round 2: Data Structures and Concepts

  • DSA Problem 1: What is Best-First Search? Questions on its properties and applications.

  • DSA Problem 2: What are the key properties of a (2,4) tree, and how do these properties impact the efficiency of search and insertion operations?

I mentioned that I had forgotten what a (2,4) tree was, and the interviewer briefly explained (in under 2 minutes) that a (2,4) tree is a type of self-balancing tree where each internal node has between 2 to 4 children, ensuring logarithmic search, insertion, and deletion times.

Follow-up Question: Write a function that inserts a key into a (2,4) tree, performing node splits and necessary rebalancing.

def insert_into_24_tree(tree: 'Node', key: int) -> 'Node':
    """
    Inserts a key into a (2,4) tree and returns the new root node.
    
    Parameters:
        tree (Node): The root node of the (2,4) tree.
        key (int): The key to insert.
        
    Returns:
        Node: The root node of the updated (2,4) tree.
    """

Discussion:

  1. How does a (2,4) tree handle balancing differently compared to other self-balancing trees like AVL or Red-Black trees?
  2. What would be the impact on performance if a (2,4) tree had larger nodes (e.g., a (3,5) tree)? How would this affect memory usage?
  3. Can you describe how deletion works in a (2,4) tree and what challenges arise compared to insertion?

Round 3: Technical Round

  • Algorithmic Proof: Prove the correctness of your implementation of a merge sort that minimizes the number of inversions. Discuss the invariant maintained at each recursive level of the algorithm.

  • Python Application: Write Python code to manage a priority queue efficiently, implementing insertions and extractions in O(log n) time.

  • Discussion:

    1. How would you handle thread safety when accessing a shared priority queue in Python, considering the Global Interpreter Lock (GIL)?
    2. How does reference counting in CPython impact multi-threaded programs, and what alternatives would you suggest for high concurrency?
    3. Discuss the difference between eager and lazy evaluation in Python.

Round 4: Managerial and Technical

  • Behavioral Question: Describe a time when you had to manage multiple conflicting deadlines in a high-stakes project. How did you ensure successful delivery?
  • Brain Teaser: magine you're in a room with 100 doors, each numbered from 1 to 100. You toggle the state of doors following a pattern: first toggle every door, then every second door, every third door, and so on, until the 100th door. After completing the toggling process, how many doors will remain open?
  • Scenario-based Question: You're leading a cross-functional team that is facing resistance to a new technology stack being introduced. How would you manage the transition and align team members with different perspectives?

Round 5: Techno-Managerial

  • Market Volatility: Explain how you would leverage implied volatility in a financial trading strategy to hedge against market risks. How do you model market sentiment when making risk management decisions?
  • You're building an API that supports both RSQL and GraphQL queries for a financial system. The API needs to handle nested filters, custom exception handling, and maintain query efficiency. How would you manage errors from deeply nested queries or malformed RSQL filters while providing clear error messages to users? Address edge cases like circular dependencies and unexpected inputs.
  • Behavioral Question: When did you demonstrate academic excellence in your work? Why do you believe academic excellence and ethics are essential, not just for an organization but for your own personal and professional growth?
Comments (5)