leetcode-326
Power of Three
Given an integer, write a function to determine if it is a power of three.
Follow up:
Could you do it without using any loop / recursion?123456789101112var NumArray = function(nums) { nums = [-2, 0, 3, -5, 2, -1];};NumArray.prototype.sumRange = function(i, j) { //var nums = [-2, 0, 3, -5, 2, -1]; var sum=0; for(var k=i;k<j;k++){ sum+=NumArray[k]; } return sum;};