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

Автор shuprog1, 10 лет назад, По-английски

Given an array A of length N, what is the best approach to answer queries of the form (i,j) where i and j are the indices of the array. Answer to a query (i,j) is the length of longest increasing subsequence of subarray from i to j. I am thinking of making a 2-D matrix which stores the length of LIS of all subarrays and then answering queries in O(1). How should I go about making that 2-D matrix? Or is there a better approach?

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

»
10 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

https://www.hackerearth.com/encoder15/algorithm/boogeyman/

This is the same problem .. you can look at some submissions from the leader board