Problem 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? Code: class Solution { public: bool isPowerOfThree(int n) { if (n <= 0) return 0; int max_pow3 = log10(I…
Problem Given an integer (signed bits), write a function to check whether it . Example: Given num = , , return false. Follow up: Could you solve it without loops/recursion? Code class Solution { public: bool isPowerOfFour(int num) { ) && ((num &am…
心情还是有问题,保持每日更新,只能如此了. Problem Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). Example: Given binary tree {,,,#,#,,}, ···· / \ / \ Result return its level order traversal as: [ [],…
本来打算写redis的,时间上有点没顾过来,只能是又拿出点自己的存货了. Problem Given an array nums, write a function to move all 's to the end of it while maintaining the relative order of the non-zero elements. Example: Given nums = [, , , , ], after calling your function, nums shou…