Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static int[] isPowerOf2(int[] nums) {
- int[] poweroftwo = new int[nums.length];
- for(int i = 0; i<nums.length; i++){
- if(nums[i]!=0 && (nums[i]&(nums[i]-1)) == 0)
- poweroftwo[i]=1;
- else poweroftwo[i] = 0;
- }
- return poweroftwo;
- }
Add Comment
Please, Sign In to add comment