题目描述 Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999. 题目解析 罗马数…
分类:Programming language
[leetcode]Same Tree
题目描述 Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if…
[leetcode]populating next right pointers in each node
题目描述 题目描述 Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; } Popul…
[Leetcode]copy list with random pointer
题目描述 A linked list is given such that each node contains an additional random pointer which could point to any node in t…
leetcode之single-number-ii、Gas station、word break
single-number-ii Given an array of integers, every element appears three times except for one. Find that single one. Not…
《剑指Offer》题目解析(12)
题目1 序列化二叉树 题目描述 请实现两个函数,分别用来序列化和反序列化二叉树 题目解析 序列化二叉树可以使用前序遍历来进行,这样的话响应的反序列化在根节点的数值读出来的时候就可以开始了。如果二叉树读的时候遇到NULL,就输出一个“\$ ”…
算法笔记之线性规划网络流问题(5)
最大收益问题 问题分析 经过分析,又根据最大流最小割定理,最大流的流值等于最小割容量。即:实验方案净收益=所有实验项目收益-最大流值。所以只需要求出最大流值即可、 算法设计 构建网络。根据输入的数据,添加源点和汇点,从源点s到每个实验项目E…