"Zero to Hero Journey" Day 3 | Introduction to Stack | Leetcode Interview Question

Revision en2, by RomeoFantastik, 2019-12-21 23:11:32

Day 3 got to an end and the best problem of day 3 was by far "132 Pattern" from Leetcode, simple but amazing problem. Here is me solving the problem of the day: https://www.youtube.com/watch?v=pqCy9Z4x4qs&feature=youtu.be

Given a sequence of n integers a[1], a[2], ..., a[n], a 132 pattern is a subsequence a[i], a[j], a[k] such that i < j < k and a[i] < a[k] < a[j]. Design an algorithm that takes a list of n numbers as input and checks whether there is a 132 pattern in the list.

This problem is our introduction to the Stack data structure. Amazing interview question, we are going through 3 brute force approaches until getting to the final idea in linear time.

Join the Competitive Programming and Interview Questions Mastermind on Facebook for daily challenges, tips and tricks and sharing experiences: https://www.facebook.com/groups/453242718909088

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English RomeoFantastik 2019-12-21 23:11:32 149
en1 English RomeoFantastik 2019-12-21 22:52:19 1099 Initial revision (published)