Блог пользователя RomeoFantastik

Автор RomeoFantastik, история, 4 года назад, По-английски

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

  • Проголосовать: нравится
  • -9
  • Проголосовать: не нравится