These are questions I had sourced from glass door and reddit before my TS interview. Two Sigma

Glassdoor

  • Tell me about yourself, your weaknesses
  • Hand find the eigenvalue in 5 minutes
  • How to send data to another process?
  • Memory allocators
  • Find max # nodes that don’t share direct relationship with each other
  • Design an in memory implementation of Sqlite, supporting create table, insert, and select queries with AND clauses
  • Design an order management trading system, parse orders and store them in an ordered manner for the buy/sell side
  • Difference between thread and process.
  • What is different in each thread.
  • What is the difference between latency and throughput
  • IPO (input-process-output) model?
  • Boardgame where winner has n consecutive moves.
  • Design a random number generator, find time and space complexity. Withput repetition?
  • find closest city ina coordinate system
  • huffman coding
  • Implement abstracted compiler build order optimizer. Took an input of source files and their corresponding build times and dependencies. Had to output the optimal build order.
  • Rnadom number not shown before in the list?
  • friend circle (leetcode?)
  • word chain (leetcode?)
  • where do you see yourself in 5 years time?
  • Describe my past technical projects, what I learned, and what I am interested in
  • Difference between a process and a thread. How process communicate and how threads communicate. Difference between latency and throughput.
  • Random number generator.
  • Follow up new range in the old generator.
  • max subarray sum of circular array
  • implement lru cache
  • LRU cache, LFU cache follow up
  • Buy and sell stocks up to k times
  • Debug median of two arrays
  • String chains hacker rank
  • Friend circles hackerrank
  • Determine two anagrams equal to each other
  • What is VWAP (volume-weighted average price)?
  • Create a filtering iterator for numbers mod 5 based on an existing iterator
  • Return element with specified probability
  • Design ATM
  • Design google maps
  • OOP design questions
  • Questions on concurrency
  • Return median value from integer stream
  • Return an item with specified probability
  • Imagine a game with a sequence of numbers. Each player can take either the head or tail element on any given turn. The player adds that number to their total score. Assuming both players play optimally, what’s the maximum score that can be achieved by any player?
  • Define an objective function for a factor-based quantitative portfolio model.
  • Define an AI algorithm for a game where two mice on a board can move up, down, left, right to look for a piece of cheese provided the manhattan distance to the cheese on any given turn. Additionally, assume there are cats, dogs, etc. also on the board that chase in the natural order, and their positions are known on any turn.
  • merge sort
  • examples of IPC (inter-process comunnication)
  • Find if a number is a power of 4
  • Reverse Polish Notation (RPN)
  • There was one slight weird question where the interviewer really wanted me to say ‘polymorphism’ (he said something like ‘When we see lots of switch statements on type we immediately think of ‘pause for me to fill in the blank’). (polymorphism)
  • Implement Concurrent Blocking Queue
  • Code a function that matches regular expressions with targets. Test is exentisvely in a main. Write a function to autogenerate test cases.
  • Code a postfix notation calculator. Follow up what if you wanted to support arbitrary operations on some variable number of preceding numbers?
  • You are given a tree in the form of a list (value, parent index, intree), where intree is a boolean donating whether the node is in the tree, and parent idx is the location in the list of the parent node. Root’s parent is -1. Write a function remove(ndx) that removes the node at that ndx and all it’s children in O(N)
  • You are given two infinite streams of data, where each datum has fields (timestamp, value). The streams have a single function take() that pops the oldest thing off and returns it or “blocks” until something arrives in the queue for it to return. Data might arrive much later than its timestamp. You are given a function output(a,b), which takes two values, one from each stream, and computes something. You want to call output() on all (a,b) pairs that have timestamps less than some given interval apart, and you want to do this as soon as any data that completes such a pair arrives. Construct pseudocode that will do this. The answer involves two threads that each manage a list of numbers pulled off their stream, pull a number from the other thread’s list, try to match it against everything, and then carefully discard data when appropriate.
  • You are managing a web service and get a complaint about the page loading slowly. What is a possible cause of the problem? How would you check that? Okay, say that’s not the problem. What else could it be?
  • String compression (leetcode)?
  • Extend RPN to include more operators
  • Software development Cycle
  • LRU
  • Max benefit 2 transactions given some stock prices (buy/sell stock)
  • Design ATM
  • Conway’s game of life algorithm. (micro-level one machine) & large-scale level (distributed systems)
  • knight on numpad question (leetcode)?
  • n-th smallest multiples of a set of integers (nth sequence for a multiple of integers)
  • add one to a number without using +
  • find all subsets of size k
  • What is Godel’s incompleteness theorem
  • floating point representation?
  • data center sync problem?
  • intuitive definition of “beta” (finance term)?
  • Copy data-sets from among N servers to each other, so that each server has a copy of all the data-sets
  • How to compress a prefix tree? (maybe directed acyclic word graph)?
  • print all the subsets of set
  • Baye’s formula? (for probability questions) P(A|B) = (P(B|A) * P(A)) / P(B)
  • What are design patterns? Examples?
  • Is null an object?
  • Difference between exception and error?

Reddit

cpu cache structure system calls trap handling