MENU

LeetCode326. 3 的幂

July 9, 2018 • Read: 3511 • LeetCode阅读设置

image找到 int 范围内最大的 3 的幂的数,然后将其对 n 取余即可

  • class Solution {
  • public boolean isPowerOfThree(int n) {
  • return (n > 0 && Math.pow(3,21) % n == 0);
  • }
  • }
Last Modified: October 10, 2018
Archives Tip
QR Code for this page
Tipping QR Code