link 链表反转

链表反转,示例如下:偶数个:a->b->c->d->e->fe->f->c->d->a->b奇数个:a->b->c->d->e->f->gg->e->f->c->d->a->b#include #include #include /************** start of stack *************/ #define STACK_SIZE 1024 char st...
阅读(3466) 评论(0)

【leetcode】Construct Binary Tree from Inorder and Postorder Traversal

Question: Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.Anwser 1 :   /** * Definition for binary tree * st...
阅读(4762) 评论(0)

【leetcode】Construct Binary Tree from Preorder and Inorder Traversal

Question:  Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.Anwser 1 :      /** * Definition for binary tree * s...
阅读(5224) 评论(1)

【leetcode】Binary Tree Inorder Traversal

Question : Given a binary tree, return the inorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3 return [1,3,2].Note: Recursive solution is trivia...
阅读(3575) 评论(0)

【leetcode】Flatten Binary Tree to Linked List

Question : Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6 The flattened tree should look like: 1 \...
阅读(4617) 评论(0)

【leetcode】Binary Tree Level Order Traversal II

Question : 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...
阅读(4946) 评论(1)

【leetcode】Balanced Binary Tree

Question : 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 of every node neve...
阅读(3362) 评论(0)

【leetcode】Minimum Depth of Binary Tree

Question : Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.Anwser 1 :   /** * Definition...
阅读(3047) 评论(0)

【leetcode】Generate Parentheses

Question :  Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:"((()))", "(()())", "(())()", "()(())", "...
阅读(3909) 评论(0)

【leetcode】Longest Valid Parentheses

Question:Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.For "(()", the longest valid parentheses substring is "()",...
阅读(3542) 评论(1)

【leetcode】Valid Parentheses

Question :  Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" are al...
阅读(3958) 评论(1)

【leetcode】Binary Tree Maximum Path Sum

Question :  Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the below binary tree, 1 / \ 2 3 Return 6.Anwser 1 :...
阅读(3124) 评论(0)

【leetcode】Letter Combinations of a Phone Number

Question : Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is given below.Input:Digit s...
阅读(4154) 评论(1)

【leetcode】Longest Consecutive Sequence

Question :  Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given [100, 4, 200, 1, 3, 2],The longest consecutive elements sequence is [1,...
阅读(3103) 评论(1)

【leetcode】Valid Number

Question : Validate if a given string is numeric.Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => trueNote: It is intended for the problem statement to be ambiguous. You s...
阅读(4209) 评论(1)

【leetcode】Word Ladder II

Question : Given two words (start and end), and a dictionary, find all shortest transformation sequence(s) from start to end, such that:Only one letter can be changed at a timeEach intermediate word m...
阅读(4362) 评论(0)

【leetcode】Word Ladder

Question :Given two words (start and end), and a dictionary, find the length of shortest transformation sequence from start to end, such that:Only one letter can be changed at a timeEach intermediate...
阅读(2629) 评论(0)

【leetcode】Best Time to Buy and Sell Stock III

Question : Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete at most two transactions.Note:You may...
阅读(2534) 评论(0)

【leetcode】Best Time to Buy and Sell Stock II

Quesion : Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie,...
阅读(2470) 评论(0)

【leetcode】Best Time to Buy and Sell Stock

Question :    Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of t...
阅读(2962) 评论(0)
86条 共5页1 2 3 4 5 ... 下一页 尾页
    个人资料
    • 访问:11690477次
    • 积分:88682
    • 等级:
    • 排名:第15名
    • 原创:708篇
    • 转载:169篇
    • 译文:16篇
    • 评论:3047条
    学习经历
    中科院、百度、创新工场、小米、阿里巴巴、米扑科技

    期货从业资格证(2017.03)
    基金从业资格证(2016.11)
    证券投资顾问证(2016.9)
    证券从业资格证(2016.6)
    系统架构设计师(2013)
    软件设计师(2008)
    CSDN创业专访

    程序员创业邦
    QQ群: 239292073
    青春,每一个有梦想的人

    资深产品经理人
    QQ群: 338142405
    思与行,人人都是产品经理

    爱脚本,爱技术
    QQ群: 320296250
    (已满)
    python、ruby、php、go、shell

    程序人生的平凡生活
    QQ群: 282297696
    (已满)
    汇聚百度、小米、微软、腾讯、
    创新工场、阿里巴巴、日本雅虎
    个人博客
    博客专栏
    博客公告
    本博客内容,由本人精心整理
    欢迎交流,欢迎转载,大家转载注明出处,禁止用于商业目的。

    文章分类