自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(11)
  • 收藏
  • 关注

原创 还不懂,以后再看

题目一:题目如下:Given n, generate all structurally unique BST's (binary search trees) that store values 1...n.For example,Given n = 3, your program should return all 5 unique BST's shown below. 1

2017-11-26 14:02:12 146

原创 validate-binary-search-tree

Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with keysless than the node's key.The right s...

2017-11-26 12:56:47 130

原创 midtorder/preorder/postorder

题目一:midordervector<int> midorderTraversal(TreeNode *root) { vector<int> res; if(root==NULL) return res; TreeNode *p=root; stack<TreeNode*> stk; while(p |...

2017-11-26 12:50:05 302

原创 same-tree/symmetric-tree

题目一:same-tree Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally identical and the nodes have the same value./*

2017-11-25 23:11:05 126

原创 中序遍历+后序遍历/前序遍历构建二叉树

题目一:中序遍历+后序遍历 Given inorder and postorder traversal of a tree, construct the binary tree. Note: You may assume that duplicates do not exist in the tree./** * Definition for binary tree * struct T

2017-11-25 22:25:57 216

原创 binary-tree-level-order-traversal

Given a binary tree, return the level order traversal of its nodes’ values. (ie, from left to right, level by level). For example: Given binary tree{3,9,20,#,#,15,7}, 3 / \ 9 20 /

2017-11-25 17:32:48 139

原创 convert-sorted-list-to-binary-search-tree

Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST./** * Definition for singly-linked list. * struct ListNode { * int val; * ListNo

2017-11-25 16:15:22 145

原创 convert-sorted-array-to-binary-search-tree

Given an array where elements are sorted in ascending order, convert it to a height balanced BST./** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * Tre

2017-11-25 15:36:42 188

原创 distinct-subsequences

Given a string S and a string T, count the number of distinct subsequences of T in S. A subsequence of a string is a new string which is formed from the original string by deleting some (can be none)

2017-11-25 13:21:40 159

原创 populating-next-right-pointers-in-each-node(i,ii)

第一问:给出的二叉树是完全二叉树 代码如下:/** * Definition for binary tree with next pointer. * struct TreeLinkNode { * int val; * TreeLinkNode *left, *right, *next; * TreeLinkNode(int x) : val(x), left(NULL), ri

2017-11-25 12:42:27 128

原创 sum-root-to-leaf-numbers

解题思路:从根结点开始,当每访问到一个结点,我们把该结点添加到路径上,并"累加"该结点的值,这里"累加"的含义指的是按照题目的要求组成相应的数字即"左移"后相加。如果该结点为叶结点,那么一条路径搜索完成,将当前所得结果累加。如果当前不是叶子结点,则继续访问它 的子结点。当前结点访问结束后,递归函数将自动回到它的父结点。因此我们在函数退出之前要在路径上"删除"当前结点,做法就是将当前路径值/10,以...

2017-11-19 19:19:55 139

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除