My main blog
Labels
Saturday, November 28, 2015
## c++ know-how for coding IV
Monday, November 23, 2015
## c++topics seldom quizzed
* pimp
-- "mid-level"
Saturday, November 7, 2015
Most algo interviews don't care about efficiency
Sunday, May 17, 2015
London bbg IV
Q: given a string of characters, find the longest "run" of any repeating character.
Q: given an array of integers, and a target, determine if there's any pair that add up to the target. Return true/false.
Q: maximum profit problem. Given a time series of historical spot FX rates, find the maximum possible trading profit by exactly one buy one sell.
Tuesday, May 12, 2015
DRW IV
a vector needs to allocate N instances of Account but Account has no default ctor. How does the compiler achieve it?
A: indeed the call to array new would prevent the vector<Account> concrete class from compiling due to SFINE rule or something like that. (Java and c# would use type constraints instead.) The compiler must be using 2 separate lines – one to allocate raw memory, the other to initialize the object.
However, when is vector internal array allocated by array new? I discussed with Ashish but found no answer.
Q: why do you need to write your own smart ptr?
A: super simple one, just to deal with some issue of the raw ptr... probably dangle pointer, by overriding the deref operator?
Q: why use unique ptr when shared ptr is general purpose
A: threading...
Q: is the lambda functionality doable in c++98? what is the c++98 equivalent?
Q: OK you don't use c++11 at work, but do you hack around at home?
Q: why is the bid/ask spread much wider in options than the underlier?
A: must be the risk to the writer. Competition didn't drive down the bid/ask spread like it did in FX and cash equities.
AA: delta hedge adjustment can't be done every second. Before the next adjust, the risk to the writer (market maker and quoter) would be quite high.
Wednesday, May 6, 2015
sticky## c++weakness revealed by interviews(+projects)
Relative to java/c#, c++ questions are more low-level (often using non-OO constructs). This is generally my strength.
I used to feel confident I can see patterns in tech interview questions and figure out what specific types of knowledge is required at a certain seniority. I was fairly successful with java/SQL/c#, but less so with c++. Based on the past questions i'm trying to make out the patterns.
=======weaknesses revealed by interviews. Probably need more work experience
(No one tested me on MI, template wizardry, etc)
STL useful tricks (like swing) -- Shanghai, synechron, Jap, WQ
specific threading constructs/techniques -- sapient, jump, SCB
boost -- jump, Jap, synechron,
mem management/optimization (like heap-only classes) -- barc-mtg, nQuant
[lg] socket -- nquant
firm grasp of language features (like rvalue ref) -- 3Arrow, bbg
essential class-based techniques/constructs (eg ref counting) -- Miami, espeed, nQuant,
[lg] COM - Barc RnA
c++11 features - DRW, 3arrow
initializing common data structures like arrays, vectors, classes -- needed in a lot of coding challenges
==These are harder to self-study -- too specialized and no pointers
linux (instrumentation) tools like truss, LD_library_path -- jump, Miami, nQuant
[lg] essential/deeper know-how (signals, OOM, stack size) not expected of a junior developer ...-- jump, Japanese, nQuant, 3Arrow, barc-mtg
[lg] extreme low-level optimization (CPU cache, custom-RTTI, byte alignment, placement new) ..-- Miami, nquant, jump
=========much-needed practical skills not quizzed by IV
pre-processor tricks
python integration
makefiles, continuous build
pthreads
debuggers,
memory leak detectors,
Sunday, April 19, 2015
AOC c++ iv (Jens/Ruban)
Saturday, April 18, 2015
bbg C++ Standard IV Questions { Zack
2. Does better O() algorithm always works faster in real cases?
3. Between pre-increment (++i) and post-increment (i++) operator, which one is more efficient in both built-in and overloading case? ........ [[more eff c++]] item 6
4. Please compare array and linked-list in terms of insertion and access
5. Please name some sorting algorithms and their time complexity
6. Can you tell me the difference between stack and heap?
7. What Linux command do I use the find a file in a directory recursively?
8. what is the virtual functions and destructors
9. what is the constructor destructor orders of a class then an inherited class
10. what is the most known sort algorithms , and what is the complexity of each
11. Smart Pointer, how does it work.
12. Templates, when use instead of inheritance........ [[eff c++]] Item 41
13. Polymorphism, when use multi inheritance, problems that can happen, ....... [[eff c++]]
14. Sockets, monitoring sockets.
15. Multithreading, give a small example of Producer, Consumer.
16. Debugging issues, using GDB
17. Linux (Windows doesn't work, it's difficult to test the person since we don't know Windows)
18. Multithreading
19. TCP/IP and Multicast
20. STL and Boost libraries
Wednesday, April 15, 2015
Friday, April 10, 2015
bbg algo IV - binary tree inorder walk
1. Elements are visited in ascending order (i.e. an inorder traversal)
2. next() and hasNext() queries run in O(1) time.
3. Memory usage is O(1)
-------
I feel O(1) memory is impossible since this is recursive (though all recursions can convert to iteration), with a stack data structure of size H := height of tree.
Similarly, hasNext() need to work through the stack of size H, so O(1) run time impossible
Sunday, April 5, 2015
IV c++11 (3arrow)
Q: What's an rvalue reference actually?
Q: mutable keyword's usage? How about in c++11?
AA: closure - captured variables can be modified if "mutable".
http://stackoverflow.com/questions/105014/does-the-mutable-keyword-have-any-purpose-other-than-allowing-the-variable-to
Translation lookaside buffer
What part of the boost thread library did you use?
for-loop in c++11?
Why did you implement your own smart pointer?
A: to avoid uninitialized primitives? That's a wrapper not a smart ptr
noexcept
AA: both an operator and a function specifier...
Can ctor throw exception? Why do you say it's not best practice?
How does a vector resize?
A: after copying the objects, destroy the old objects. (move ctor?)
What kind of algo is qsort? Average and worst runtime complexity?
A: average nLog(n), worse n^2
Recursive vs iterative, which is faster?
A: comparable, but space complexity lower for iterative?
what's lockfree? How did you make it work in your projects?
How did you use parallel processing in GS?
A: data parallellism, threading, and other techniques. Coarse-grained is ideal.
A: i guess pipelining parallellism is also relevant, using task queues
Monday, March 30, 2015
advanced c++ interview questions - contributed by real interviewers
Fwd: difficult phone screen with Credit Suisse
Fwd: vague question { xr - production troubleshoot
Fwd: java threading questions {xr
Fwd: MS IV 20141211
Fwd: Bloomberg interview questions 2/13/2015 {XR
Base on input 2 strings, return a regex String that can cover 2 input strings.
e.g "Bloomberg", "BloomingDale" should output "Bloom.*g.*"
I proposed a solution:
step 1: find out common segments of the 2 strings
step 2: insert ".*" in between the common segments to form a string
He asked: how to find the common segments?
also he let me think of below examples, but I really couldn't find any
clue from his example.
"Bloomberg", "BloomingDale"
"StarBucksCoffee", "RedCoffee"
In the end, he said my proposed solution is not technically optimized.
Obviously, he has better solution, but he didn't give me the hint.
So I still have no idea at all.
Can you think of a solution?
Saturday, November 15, 2014
CompletionService + others (Credit Suisse IV
safe publication
fail fast vs fail safe
timers (scheduled task queue, scheduled thread pool)
3 ways to create threads
how to shut down a multithreaded app
handle all exceptions in a thread pool?
Monday, October 13, 2014
Fwd: Markit phone interview, full time position, 10/13/14
Date: Tue, Oct 14, 2014 at 4:02 AM
Subject: Markit phone interview, full time position, 10/13/14
Friday, October 10, 2014
Fwd: Barcap onsite interview, 10/09/14
Date: Fri, Oct 10, 2014 at 7:56 AM
Subject: Barcap onsite interview, 10/09/14