Dp and Time limit

Can an algorithm of order O(n^2) (Dp) pass all test cases where 2≤n≤10^5 and queries up to 10^5 ??

You should mention the time limit too. In any case, O(n^2) won’t pass for n = 1e5, which will probably require hours to run.

1 Like