Quantitative Strategist was asked...18 December 2010

↳

Insert the new element after the current head, and then swap the new value with the current head. Less

↳

For a singly linked circular list, assuming you have a pointer to the tail of the list (rather than the head) to make insertion at head and tail constant time, here's how to insert at the beginning (head) in constant time: temp = Node(val2BeInserted) temp.setNext(self.tail.getNext()) self.tail = temp (given the classes Node and SinglyLinkedCircularList) with (value,next=None) and (tail) attributes, respectively. Less

↳

For a singly linked circular list, assuming you have a pointer to the tail of the list (rather than the head) to make insertion at head and tail constant time, here's how to insert at the beginning (head) in constant time: temp = Node(val2BeInserted) temp.setNext(self.tail.getNext()) self.tail = temp (given the classes Node and SinglyLinkedCircularList) with (value,next=None) and (tail) attributes, respectively. Less

Quantitative Strategist was asked...15 October 2015

Quantitative Strategist was asked...18 November 2013

↳

Make two arrays: accumulated sum and maximum sum. Start from index 0 and move to end. maximum sum would be max of accumulated sum till current position. Refresh accumulated sum once its smaller than the current number. Less

Quantitative Strategist was asked...16 December 2017

↳

The (formal) solution lies in the distribution of order statistics for a sample of 2 from the standard uniform. It is not too hard to show that the solution is 1-P(Max 1/2)-P(Range>1/2), and with a combinatorics/conditional probability argument, it is equivalent to 1-3*P(Max <1/2). P(Max< 1/2) = 1/4, so the probability of that the pieces can form a triangle is 1/4. Less

Quantitative Strategist was asked...25 August 2011

Quantitative Strategist was asked...24 April 2019

Quantitative Strategist was asked...26 November 2017

↳

I wasn't prepared

Quantitative Strategist was asked...24 June 2021

↳

The locations of the 4 picked points on the circle don't matter, you will always have three possibilities to divide them into two pairs, of which one yields intersecting lines. Therefore, no matter if you distribute 20 or 10000 points on the circle, the probability of intersecting lines of two pairs will always be 1/3 Less

Quantitative Strategist was asked...10 December 2017

↳

What is the step size?