- 博客(8)
- 收藏
- 关注
原创 树--Minimum Depth of Binary Tree
题目: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.class Solution {public: int run(...
2018-08-31 00:08:44 154
原创 栈-evaluate-reverse-polish-notation
题目:Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are+,-,*,/. Each operand may be an integer or another expression.Some examples: ["2", "1", "+", "...
2018-08-31 00:06:45 107
原创 穷举--max-points-on-a-line
题目:Given n points on a 2D plane, find the maximum number of points that lie on the same straight line./** * Definition for a point. * struct Point { * int x; * int y; * Point() : x(...
2018-08-31 00:04:30 147
原创 十进制转任意进制
题目描述输入两个不超过整型定义的非负10进制整数A和B,输出A+B的m (1 < m <10)进制数。输入描述输入格式:测试输入包含若干测试用例。每个测试用例占一行,给出m和A,B的值。当m为0时输入结束。输出描述输出格式:每个测试用例的输出占一行,输出A+B的m进制数。 #include <stdio.h>#include <math...
2018-08-30 23:59:29 693
原创 链表--sort-list
题目:Sort a linked list in O(n log n) time using constant space complexity./** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) ...
2018-08-30 23:53:34 91
原创 面试题3:数组中重复的数字
题目:在一个长度为n的数组里,所有数字都在0 - n-1范围内,数组中的某些数字是重复的,但不知道有几个重复的。请找出其中的任意一个重复数字。举例:{2,3,1,0,2,5,3对应重复的数字为2或者3。方法一,哈希表法: bool duplicate(int numbers[], int length, int* duplication) {//duplicate重复
2017-06-01 22:21:11 179
原创 动态规划问题--最长公共子序列(LCS)问题--删除一些字符使得剩下的是一个回文子串
题目:给定一个字符串s,你可以删除一些字符,使得剩下的串是一个回文串。如何删除才能使得回文串最长,输出需要删除的字符个数。输入描述:输入数据包含多组,每组包含一个字符串s,并且保证:1输出描述:对于每一组数据,输出一个整数,代表最少需要删除的字符个数。输入例子:google输出例子:2知识点:最长公共字串和公共子序列的区别,字串必须连续,子序列不必连续。vect
2017-05-22 17:35:18 482
原创 无分类域间路由选择CIDR
CIDR特点:1. 消除传统的A,B,C地址和划分子网的概念,更有效分配IPV4地址空间,使用各种长度的“网络前缀“来替代地址中的网络号和子网号。2. CIDR把网络前缀都相同的连续IP地址组成一个“CIDR地址块”,即强化路由聚合。构成超网:将网络前缀缩短,网络前缀越短,地址快所包含的地址数就越多。在使用CIDR中,在查找路由表时可能会得到不止一个匹配结果,应选择具有最长网络前缀
2017-05-16 23:17:18 1633
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人