Caching Across Queries

Правка en1, от Honestly, 2025-06-23 13:06:00

While solving dp ,i think we have all solved the problem subset sum==target ,its pretty basic ,now what if there were q queries for different target sums,obviously the brute force wud be to reconfigure the dp array before each query ,but the whole process would then take O(N*Q*T) time ,which has a high chance of giving TLE, can you guys suggest ways to initialize the dp array only once ,and keep it constant across all queries ?

Теги dp, queries

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский Honestly 2025-06-23 13:06:00 454 Initial revision (published)