Longest Subsequence with difference 1

Правка en1, от 150iq, 2021-04-27 14:05:38

Is it possible to solve this problem in O(n) given that the numbers can only be in the range from 1 to 1000?

P.S: I tried solving this in O(n) but I am getting WA. I also created a random input generator and compared my output with the correct code for n = 100 and values from 1 to 100 but didn't find any difference.

My Code
Теги # dp, #dynamic programing, # 2d dp

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский 150iq 2021-04-27 14:05:38 963 Initial revision (published)