摘要:
题目要求 A sentence S is given, composed of words separated by spaces. Each word consists of lowercase and uppercase letters only. We would like to conver 阅读全文
摘要:
题目要求 Alice and Bob have candy bars of different sizes: A[i] is the size of the i-th bar of candy that Alice has, and B[j] is the size of the j-th bar 阅读全文
摘要:
题目要求 In an alien language, surprisingly they also use english lowercase letters, but possibly in a different order. The order of the alphabet is some 阅读全文
摘要:
题目要求 Given an array A of positive lengths, return the largest perimeter of a triangle with non-zero area, formed from 3 of these lengths. If it is imp 阅读全文
摘要:
题目要求 Invert a binary tree. 题目分析及思路 给定一棵二叉树,要求每一层的结点逆序。可以使用递归的思想将左右子树互换。 python代码 # Definition for a binary tree node. # class TreeNode: # def __init__ 阅读全文
摘要:
题目要求 Given a positive integer, check whether it has alternating bits: namely, if two adjacent bits will always have different values. 题目分析及思路 给定一个正整数, 阅读全文
摘要:
题目要求 Given two integers L and R, find the count of numbers in the range [L, R] (inclusive) having a prime number of set bits in their binary represent 阅读全文
摘要:
题目要求 Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array. 题目分析及思路 给定一棵非空二叉树,要求以列表的形式返回每一层结点值的平均 阅读全文
摘要:
题目要求 Given an n-ary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). 题目分析及思路 给定一棵N叉树,要求返回它的层次遍历结 阅读全文
摘要:
题目要求 In MATLAB, there is a very useful function called 'reshape', which can reshape a matrix into a new one with different size but keep its original 阅读全文