一、题目描述 Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example: Given num 16, return true. Given num 5, return false. Follow up: Could you solve it without loops/recursion? 题目解读:判断一个数是否…
一、题目描述 Given a binary tree, return the bottom-up level order traversal of its nodes values. (ie, from left to right, level by level from leaf to root). For example: Given binary tree [3,9,20,null,null,15,7], 3/ \9 20/ \15 7return its bottom-up l…
一、题目描述 Implement the following operations of a queue using stacks.
push(x) -- Push element x to the back of queue.pop() -- Removes the element from in front of queue.peek() -- Get the front element.empty() -- Return whether the queue is empty.
Note…
一、题目描述 Given numRows, generate the first numRows of Pascals triangle. For example, given numRows 5, Return
[[1],[1,1],[1,2,1],[1,3,3,1],[1,4,6,4,1]
] 题目解读:给出行数,返回一个杨辉三角 杨辉三角的特点:
(1…
一、题目描述 Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space for another array, you must do this in place with constant memory. For example, Given input arr…