- Read Constraints First.
- If constraints around 1e4 can use bitset.
- Disconnected components common property to be found use a dummy node.
- If A1 and An are adjacent double the array.
- Use stack to find left and right boundaries.
- For Mathematical problems workout small cases.
- Check for small inputs and hence pigeonhole priciple.
- Think like a brute force solution first.
- Think the problems in backward direction.
- For cyclic shifts of permutations use position indexing.
- Primes upto 1e7 always use linear sieve.
- Constructive problems make partitions.
- Problems with a edge contributions can be solved using DSU.