码迷,mamicode.com
首页 >  
搜索关键字:binary    ( 11734个结果)
【LeetCode-面试算法经典-Java实现】【067-Add Binary(二进制加法)】
【067-Add Binary(二进制加法)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题  Given two binary strings, return their sum (also a binary string).   For example,   a = "11"   b = "1"   Return "100" 题目大意  给定两个二进制的字符串...
分类:编程语言   时间:2015-08-02 06:23:42    阅读次数:194
[CareerCup] 4.4 Create List at Each Depth of Binary Tree 二叉树的各层创建链表
4.4 Given a binary tree, design an algorithm which creates a linked list of all the nodes at each depth (e.g., if you have a tree with depth D, you'll...
分类:其他好文   时间:2015-08-02 00:55:41    阅读次数:137
leetcode-190-Reverse Bits
Reverse Bits    Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represen...
分类:其他好文   时间:2015-08-01 23:36:18    阅读次数:145
Path Sum II
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree andsum =...
分类:其他好文   时间:2015-08-01 23:27:33    阅读次数:114
leetCode 106.Construct Binary Tree from Inorder and Postorder Traversal (根据中序遍历和后序遍历构造二叉树)
Given inorder and postorder traversal of a tree, construct the binary tree. Note: You may assume that duplicates do not exist in the tree. 思路:这题和上题类似,前序第一个是根节点,后序遍历最后一个是根节点。其余步骤类似。 代码如下: /** *...
分类:其他好文   时间:2015-08-01 22:10:16    阅读次数:150
leetCode 105.Construct Binary Tree from Preorder and Inorder Traversal (根据前序遍历和中序遍历构造二叉树)
Given preorder and inorder traversal of a tree, construct the binary tree. Note: You may assume that duplicates do not exist in the tree. 思路:首先根据前序遍历得到根节点,然后在中序遍历中得到根节点的位置,左边的为左子树,右边的为右子树。 然后再...
分类:其他好文   时间:2015-08-01 22:09:32    阅读次数:138
leetCode 103.Binary Tree Zigzag Level Order Traversal (二叉树Z字形水平序) 解题思路和方法
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between). For example: Given binary ...
分类:其他好文   时间:2015-08-01 22:08:36    阅读次数:141
leetCode 104.Maximum Depth of Binary Tree(二叉树最大深度) 解题思路和方法
Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. 思路:很基础的一个题,DFS即可。代码如下: /** * Defin...
分类:其他好文   时间:2015-08-01 22:08:25    阅读次数:140
leetCode 107.Binary Tree Level Order Traversal II (二叉树水平序)
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,#,#,15,7}, ...
分类:其他好文   时间:2015-08-01 22:07:00    阅读次数:129
Sqrt(x)
Question Implement int sqrt(int x). Compute and return the square root of x. My Solution class Solution { public: int mySqrt(int x) { /** * binary search a from [0, x], where a^2 = x....
分类:其他好文   时间:2015-08-01 22:06:03    阅读次数:87
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!