Visa Inc. interview question

1) frog dp question 2) stack question