Problem Link: Download
Backgroud of the Solution:
1. the value of j can be less than the value of i; i.e j<i
2. i=j
3. The order of i and j in output must be the same as the input, even when j is smaller than i.
Note: To get the problem in good time you must create an array with size 1000000. Then you can apply recursive algorithm.
Code In C/C++: (Brute force algorithm)
Code In C/C++: (Recursive Algorithm)
Backgroud of the Solution:
1. the value of j can be less than the value of i; i.e j<i
2. i=j
3. The order of i and j in output must be the same as the input, even when j is smaller than i.
Note: To get the problem in good time you must create an array with size 1000000. Then you can apply recursive algorithm.
Code In C/C++: (Brute force algorithm)
Code In C/C++: (Recursive Algorithm)
No comments:
Post a Comment