Quote:
what is the best method to tacle this problem soluton. If anyone had an idea then share me to solve me this problem.
The best method is the one you device after trying simple non optimal methods.
You get good at designing algorithm because train to solve problems.
For every problem:
- Either you know the best solution: then you got your algorithm.
- Otherwise, you need to study the problem and then design an algorithm.
Design an algorithm:
- Train yourself to solve the problem by hand, create some sample inputs for further training.
- Design the algorithm from the method you have used to solve by hand.
- Code, run, debug your algorithm.
- Analyze weaknesses of your algorithm, and refine the algorithm.
Your ability to solve problems improves with experience. Every time you ask us to dothe job for you will prevent your from gaining experience.
Here we help you to fix your code.