2 Solutions ( 0 ms & 1ms) || 2 Different Approaches Explained || Super Easy || Java😊
Explaination for Approach 1 :\n\nThe equation calculation formula for 100 number to 7 is like this below.\n7|100\n7|14|2\n7|2|0\n7|2|2\nAns:202(base 7)\n\n# Req
# Explaination for Approach 1 :\n```\nThe equation calculation formula for 100 number to 7 is like this below.\n7|100\n7|14|2\n7|2|0\n7|2|2\nAns:202(base 7)\n```\n# Request \uD83D\uDE0A :\n```\nIf you find these solutions easy to understand and helpful, then\nPlease Upvote\uD83D\uDC4D\uD83D\uDC4D (Scroll Down for fastest [0 ms] approach).\n```\n# Approach 1 : 1ms Solution\n```\nclass Solution \n{\n    public String convertToBase7(int num) \n    {\n        if(num<0)\n            return "-"+convertToBase7(-num);//if negative make posiitve input in function\n        else if(num < 7) \n            return Integer.toString(num);//return as string the same number\n        else\n            return convertToBase7(num/7) + convertToBase7(num%7);//greater than 7\n    }\n}\n```\n# Approach 2 : 0ms Solution [Fastest]\n```\nclass Solution \n{\n    public String convertToBase7(int num) \n    {\n        return Integer.toString(num, 7);\n    }\n}\n```
['Math', 'Java']