How should I approach competitive programming? Should I first learn the necessary algorithms and data structures and then start solving questions or should I try to solve the problem with basic mathematical knowledge and when I cannot do that then I learn the necessary algorithm?