We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b91312c commit deffcd9Copy full SHA for deffcd9
solution/0500-0599/0504.Base 7/README_EN.md
@@ -166,6 +166,25 @@ impl Solution {
166
167
<!-- tabs:end -->
168
169
+### Solution 2: Concise Implementation (Integer.toString)
170
+
171
+We can directly use Java’s built-in base conversion method.
172
+Time complexity: $O(\log_7 n)$, space complexity: $O(1)$.
173
174
+<!-- tabs:start -->
175
176
+#### Java
177
178
+```java
179
+class Solution {
180
+ public String convertToBase7(int num) {
181
+ return Integer.toString(num, 7);
182
+ }
183
+}
184
+```
185
186
+<!-- tabs:end -->
187
188
<!-- solution:end -->
189
190
<!-- problem:end -->
0 commit comments