摘要:
题目描述 给出一个非负整数数组,你最初在数组第一个元素的位置 数组中的元素代表你在这个位置可以跳跃的最大长度 判断你是否能到达数组最后一个元素的位置 例如 A =[2,3,1,1,4], 返回 true. A =[3,2,1,0,4], 返回 false. Given an array of non 阅读全文
摘要:
题目描述 一只青蛙一次可以跳上1级台阶,也可以跳上2级……它也可以跳上n级。求该青蛙跳上一个n级的台阶总共有多少种跳法。 class Solution {public: int jumpFloorII(int number) { int jumpFlo=1; while(--number) { ju 阅读全文
摘要:
题目描述 在O(n log n)的时间内使用常数级空间复杂度对链表进行排序。 Sort a linked list in O(n log n) time using constant space complexity. 示例1 输入 复制 {3,2,4} 输出 复制 {2,3,4} class So 阅读全文
摘要:
题目描述 给出一棵树的中序遍历和后序遍历,请构造这颗二叉树 注意: 保证给出的树中不存在重复的节点 Given inorder and postorder traversal of a tree, construct the binary tree. Note: You may assume tha 阅读全文