D.E.Shaw 2020 Intern 校园面

Round 1: (Online Coding Round – 75 min on Hackerrank)
Question 1 : Price of share increase by 1 for first 3 days. Decrease by 2 for next 3 days. Increase by 3 for next 3 days and so on. Given a price of share
and number of days N . Find the price of share after N days.
Question 2 : Given a number N, find the lexicographical rth smallest permutation of numbers from [1, N]. Output the last number of permutation.

Round 2:
Question 1 : Given a Pre – Order and In – Order Traversal, find the binary tree
Question 2 : Given a large library of books, and a set of words. Find the book which has all the words present in set. (we can use hash-map)
Question 3 : Given stocks values at N days, find the maximum profit we can gain by selling and purchasing stocks on different days. (For each day, just
maximum sell value of stock present in days following that day)
Question 4 : What is encapsulation, inheretance, Virtual Function .
Question 5 : How Virtual Functions work ( Vtable and Vptr). Draw Vtable and Vptr for given set of classes.
Question 6 : Why object is passed as reference in copy constructor and not by value or pointer.