What is the space complexity for DFS approach?
palindrome88
@palindrome88
Posts made by palindrome88

Space complexity

Allow driver
Write function to determine when a driver can drive?Drivers are not allowed to drive a total of 14 hours without an 8 hour break.
Input: shifts(shiftStart, shiftEnd), current time(can be > 24)
[(0, 11), (12, 19)], 24
For the above example the function should return true
[(0, 3), (4, 8), (9, 13), (14, 18), (19, 23)], 24
For the above example, the function should return false. (30)+(84)+4+4 > 12, driver has to take a break, so function has to return false. 
RE: My java solution with FIFO queue
what is the time complexity for iterative version?

RE: String pyramid transition matrix
Can someone help with pseudo code or algorithm? Thanks.

RE: Guess 4digit random number with a testing function
@awice Hey, do you have sample code?

Minimize guesses
I am extending the problem. I want to know what is the optimal way to use the output of "Cows and Bulls" hint to guess the next number?

String pyramid transition matrix
I was asked the below question in my Google phone interview.
Problem: given a list of leaf nodes in a pyramid ，and a map which indicates what's the possible parent node given a left and right node. Return true if the one of leaf node could turn into the root node, Otherwise, return false.Example: root / \ X X /\ /\ X X X / \/ \/ \ A B C D Map: left: A  B  C  D right  A B  A or C  D  A B D B or C  A  C B D
Note:1. If left child is B, right child is A, the parent node could be B or C
Refer: https://stackoverflow.com/questions/43432699/stringpyramidtransitionmatrix

RE: 8 sliding puzzle
@awice Thank you. For what value of n, I should worry about out of memory for the BFS solution?