题目链接 Given two integers n and k, return all possible combinations of k numbers out of 1 ... n. For example, If n = 4 and k = 2, a solution is: [[2,4],[3,4],[2,3],[1,2],[1,3],[1,4],
] 分析: leetcode121,求所有的组合 算法1:递归解法
题目 Given a positive integer, check whether it has alternating bits: namely, if two adjacent bits will always have different values. Example 1: Input: 5
Output: True
Explanation:
The binary representation of 5 is: 101 Example 2: Input: 7
Output: False
E
题目链接 Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees ofeverynode never differ by more than 1. 分析:判断一颗二叉树是否是平