Update appNew update is available. Click here to update.
About
My Stats
EXP gained
yellow-spark
2086
Level
5 (Champion)
Community stats
Discussions
1
Upvotes
1
Know more
43
Total problems solved
39
Easy
4
Moderate
0
Hard
0
Ninja
Jan Jan Feb Feb Mar Mar Apr Apr May May Jun Jun Jul Jul Aug Aug Sep Sep Oct Oct Nov Nov Dec Dec

Current streak:

0 days

Longest streak:

5 days

Less

More

Achievements
1
Ronin
Topics
Arrays
Discussions
Java Code with recursion
Interview problems

public class Solution {

    public static int[] printNos(int x) {

        return printF(0, x, new int[x]);

    }

 

    private static int[] printF(int i,int x,int[] result){

       

        if(i==x){

            return result;

        }

        result[i]=i+1;

        return printF(i+1, x, result);

    }

}

profile
Rohit Manohar
Published On 07-Aug-2023
152 views
0 replies
0 upvotes