I have been submitting a few java submissions lately and all of them have been getting Time Limit Exceeded even though I think I am either doing the same solution as the editorial or my solution runs in O(n).
Here are two examples: https://codeforces.com/contest/1334/submission/126210107
https://codeforces.com/contest/1334/submission/126127281
Why is this happening? It's quite discouraging to think I solved a problem with an OK solution then TLE so many times...
Thanks!