How to tackle Leetcode problems?

How should I practise the Leetcode problems? Sometimes due to low constraints, my non-optimal solution gets accepted, but it is not right.
Should i follow this approach-

  1. Solve the problem.
  2. Go to discuss and check if other optimal solution exists

Or is there any other way. Any suggestion would be appreciated.

1 Like