摘要:
112题目如下: Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the giv 阅读全文
摘要:
Implement atoi to convert a string to an integer. 题目分析: 题目本身很简单就是将一个字符串转化成一个整数,但是由于字符串的千差万别,导致在实现的时候细节非常多。需要注意的有以下一些: 1.字符串可能由一些空格开始,然后遇到一个正号或者负号,然后是正 阅读全文
摘要:
leetcode网站原题如下:给一个非负数组,开始位置是下标为0的元素,数组的元素代表当前位置最多向前行进多少个位置,判断是否能到达数组的最后一个位置,能就回复true,不能就回复false. Given an array of non-negative integers, you are init 阅读全文
摘要:
C++的面向对象的Dijkstra写法面向对象特点的充分使用清晰的逻辑简洁的图输入程序面向对象特点的充分使用清晰明确的类实现 class Edge(边的实现) class Req (路由请求的实现) class Graph (图的实现) 其中将Dijkstra算法放置在Graph里... 阅读全文