- 博客(78)
- 资源 (7)
- 问答 (1)
- 收藏
- 关注
原创 hihoCoder 1068 : RMQ-ST算法
#1068 : RMQ-ST算法时间限制:10000ms单点时限:1000ms内存限制:256MB描述小Hi和小Ho在美国旅行了相当长的一段时间之后,终于准备要回国啦!而在回国之前,他们准备去超市采购一些当地特产——比如汉堡(大雾)之类的回国。但等到了超市之后,小Hi和小Ho发现者超市拥有的商品种类实在太多了——他们实在看不过来了!于
2015-04-29 21:33:05 573
原创 hihoCoder 1043 : 完全背包
#1043 : 完全背包时间限制:20000ms单点时限:1000ms内存限制:256MB描述且说之前的故事里,小Hi和小Ho费劲心思终于拿到了茫茫多的奖券!而现在,终于到了小Ho领取奖励的时刻了!等等,这段故事为何似曾相识?这就要从平行宇宙理论说起了………总而言之,在另一个宇宙中,小Ho面临的问题发生了细微的变化!小Ho现在手上
2015-04-28 22:30:42 466
原创 hihoCoder 1038 : 01背包
#1038 : 01背包时间限制:20000ms单点时限:1000ms内存限制:256MB描述且说上一周的故事里,小Hi和小Ho费劲心思终于拿到了茫茫多的奖券!而现在,终于到了小Ho领取奖励的时刻了!小Ho现在手上有M张奖券,而奖品区有N件奖品,分别标号为1到N,其中第i件奖品需要need(i)张奖券进行兑换,同时也只能兑换一次,为了
2015-04-28 22:28:41 506
原创 Flatten Binary Tree to Linked List 将二叉树转为链表
Flatten Binary Tree to Linked List Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The f
2015-04-28 11:23:18 456
原创 Path Sum II 二叉树求和
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 and sum = 22, 5
2015-04-28 11:21:13 775
原创 Convert Sorted List to Binary Search Tree 将链表转为二叉搜索树
Convert Sorted List to Binary Search Tree Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST./** * Definition for singly-linked l
2015-04-28 11:21:09 510
原创 Convert Sorted Array to Binary Search Tree 将排序的数组转换为二叉搜索树
Convert Sorted Array to Binary Search Tree Given an array where elements are sorted in ascending order, convert it to a height balanced BST./** * Definition for binary tree * struct Tree
2015-04-28 11:20:29 452
原创 Construct Binary Tree from Inorder and Postorder Traversal 中序和后序重建二叉树
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 i
2015-04-28 11:19:38 530
原创 Construct Binary Tree from Preorder and Inorder Traversal 前序和中序重建二叉树
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 th
2015-04-28 11:17:41 481
原创 hihoCoder 1098 : 最小生成树二·Kruscal算法
#1098 : 最小生成树二·Kruscal算法时间限制:10000ms单点时限:1000ms内存限制:256MB描述随着小Hi拥有城市数目的增加,在之间所使用的Prim算法已经无法继续使用了——但是幸运的是,经过计算机的分析,小Hi已经筛选出了一些比较适合建造道路的路线,这个数量并没有特别的大。所以问题变成了——小Hi现在手上拥有N
2015-04-28 11:16:36 674
原创 hihoCoder 1097 : 最小生成树一·Prim算法
#1097 : 最小生成树一·Prim算法时间限制:10000ms单点时限:1000ms内存限制:256MB描述最近,小Hi很喜欢玩的一款游戏模拟城市开放出了新Mod,在这个Mod中,玩家可以拥有不止一个城市了!但是,问题也接踵而来——小Hi现在手上拥有N座城市,且已知这N座城市中任意两座城市之间建造道路所需要的费用,小Hi希望知道,
2015-04-28 11:15:37 569
转载 计算机网络 面试总结2
1 、 OSI ( Open System Interconnect ):开放系统互联,是一个七层的计算机网络模型,分别为:物理层、数据链路层、网络层、传输层、会话层、表示层和应用层。TCP/IP ( Transmission Control Protocol/Internet Protocol ):传输控制协议 / 因特网互联协议,是一个四层的计算机网络模型,分别为:网络接口层、网络层、传输
2015-04-27 18:00:28 592
转载 计算机网络 面试总结1
1、OSI的七层协议、TCP/IP的四层协议、谢希仁老师的网络课本提到的五层协议的对比注:(1)OSI的七层协议只是理论上的协议,实际上没有用到。(2)TCP/IP的四层协议在真正在实际中用到的体系结构。(3)谢老课本中提到的五层协议只是为了更好的讲解概念而采用的折中方法。2、OSI的七层协议(1)第七层、应用层作用:直接为用户的
2015-04-27 17:59:50 1027
原创 hihoCoder 1089 : 最短路径·二:Floyd算法
#1089 : 最短路径·二:Floyd算法时间限制:10000ms单点时限:1000ms内存限制:256MB描述万圣节的中午,小Hi和小Ho在吃过中饭之后,来到了一个新的鬼屋!鬼屋中一共有N个地点,分别编号为1..N,这N个地点之间互相有一些道路连通,两个地点之间可能有多条道路连通,但是并不存在一条两端都是同一个地点的道路。由于
2015-04-27 17:53:27 502
原创 hihoCoder 1093 : 最短路径·三:SPFA算法
#1093 : 最短路径·三:SPFA算法时间限制:10000ms单点时限:1000ms内存限制:256MB描述万圣节的晚上,小Hi和小Ho在吃过晚饭之后,来到了一个巨大的鬼屋!鬼屋中一共有N个地点,分别编号为1..N,这N个地点之间互相有一些道路连通,两个地点之间可能有多条道路连通,但是并不存在一条两端都是同一个地点的道路。不过
2015-04-27 17:53:13 712
原创 hihoCoder 1081 : 最短路径·一
#1081 : 最短路径·一时间限制:10000ms单点时限:1000ms内存限制:256MB描述万圣节的早上,小Hi和小Ho在经历了一个小时的争论后,终于决定了如何度过这样有意义的一天——他们决定去闯鬼屋!在鬼屋门口排上了若干小时的队伍之后,刚刚进入鬼屋的小Hi和小Ho都颇饥饿,于是他们决定利用进门前领到的地图,找到一条通往终点的最
2015-04-27 17:51:59 512
原创 Second Highest Salary
Second Highest Salary Write a SQL query to get the second highest salary from the Employee table.+----+--------+| Id | Salary |+----+--------+| 1 | 100 || 2 | 200 || 3 | 300
2015-04-25 17:53:31 393
原创 Combine Two Tables
Combine Two Tables Table: Person+-------------+---------+| Column Name | Type |+-------------+---------+| PersonId | int || FirstName | varchar || LastName | varchar |
2015-04-25 17:52:27 515
原创 hihoCoder 1032 : 最长回文子串
#1032 : 最长回文子串时间限制:1000ms单点时限:1000ms内存限制:64MB描述 小Hi和小Ho是一对好朋友,出生在信息化社会的他们对编程产生了莫大的兴趣,他们约定好互相帮助,在编程的学习道路上一同前进。 这一天,他们遇到了一连串的字符串,于是小Hi就向小Ho提出了那个经典的问题:“小Ho,你能不能分别在这些字符
2015-04-25 16:08:15 533
原创 hihoCoder 1015 : KMP算法
#1015 : KMP算法时间限制:1000ms单点时限:1000ms内存限制:256MB描述小Hi和小Ho是一对好朋友,出生在信息化社会的他们对编程产生了莫大的兴趣,他们约定好互相帮助,在编程的学习道路上一同前进。这一天,他们遇到了一只河蟹,于是河蟹就向小Hi和小Ho提出了那个经典的问题:“小Hi和小Ho,你们能不能够判断一段文字(
2015-04-25 16:06:58 674
原创 hihoCoder 1014 : Trie树
#1014 : Trie树时间限制:10000ms单点时限:1000ms内存限制:256MB描述小Hi和小Ho是一对好朋友,出生在信息化社会的他们对编程产生了莫大的兴趣,他们约定好互相帮助,在编程的学习道路上一同前进。这一天,他们遇到了一本词典,于是小Hi就向小Ho提出了那个经典的问题:“小Ho,你能不能对于每一个我给出的字符串,都在
2015-04-24 22:20:23 505
原创 微软2016校园招聘在线笔试第二场 题目1 : Lucky Substrings
题目1 : Lucky Substrings时间限制:10000ms单点时限:1000ms内存限制:256MB描述A string s is LUCKY if and only if the number of different characters in s is a fibonacci number. Given a strin
2015-04-24 21:31:54 1209
原创 Validate Binary Search Tree 二叉搜索树的合法判断
Validate Binary Search Tree Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes w
2015-04-24 21:27:27 556
原创 Binary Tree Zigzag Level Order Traversal 之字形遍历二叉树
Binary Tree Zigzag Level Order Traversal 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
2015-04-24 21:27:13 513
原创 Unique Binary Search Trees 二叉树的种类
Unique Binary Search Trees Given n, how many structurally unique BST's (binary search trees) that store values 1...n?For example,Given n = 3, there are a total of 5 unique BST's. 1
2015-04-24 21:24:54 481
原创 Binary Tree Inorder Traversal 二叉树的中序遍历
Binary Tree Inorder Traversal Given a binary tree, return the inorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [
2015-04-24 21:24:16 408
原创 Unique Binary Search Trees II 二叉树的种类
Unique Binary Search Trees II Given n, generate all structurally unique BST's (binary search trees) that store values 1...n.For example,Given n = 3, your program should return all 5 uniq
2015-04-24 21:23:59 550
原创 Restore IP Addresses
Restore IP Addresses Given a string containing only digits, restore it by returning all possible valid IP address combinations.For example:Given "25525511135",return ["255.255.11.135",
2015-04-24 21:22:14 310
原创 Reverse Linked List II
Reverse Linked List II Reverse a linked list from position m to n. Do it in-place and in one-pass.For example:Given 1->2->3->4->5->NULL, m = 2 and n = 4,return 1->4->3->2->5->NULL.No
2015-04-22 16:49:30 312
原创 Decode Ways 字符操作
Decode Ways A message containing letters from A-Z is being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message containing digits, de
2015-04-22 16:48:32 469
原创 Gray Code 格雷码
Gray Code The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the total number of bits in the code, prin
2015-04-22 16:46:57 400
原创 Subsets II 全排列包含重复的
Subsets II Given a collection of integers that might contain duplicates, S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set mus
2015-04-22 16:46:26 536
转载 平衡树 算法摘记
平衡树是计算机科学中的一类改进的二叉查找树。一般的二叉查找树的查询复杂度是跟目标结点到树根的距离(即深度)有关,因此当结点的深度普遍较大时,查询的均摊复杂度会上升,为了更高效的查询,平衡树应运而生了。在这里,平衡指所有叶子的深度趋于平衡,更广义的是指在树上所有可能查找的均摊复杂度偏低。对一棵查找树(search tree)进行查询/新增/删除 等动作, 所花的时间与树的
2015-04-22 11:07:57 840
原创 Remove Duplicates from Sorted List II 链表去除重复值
Remove Duplicates from Sorted List II Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.For example,Given 1->
2015-04-20 18:52:23 452
原创 Partition List 链表的partition操作 分成2个链表
Partition List Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.You should preserve the original relative order
2015-04-20 18:51:54 516
原创 Search in Rotated Sorted Array II 旋转数组二分查找 有重复
Search in Rotated Sorted Array II Follow up for "Search in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-time complexity? How and why?Write a function
2015-04-20 18:49:34 543
原创 Remove Duplicates from Sorted Array II 允许重复2次数组
Remove Duplicates from Sorted Array II Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array A = [1,1,1,2,2,3],Your function s
2015-04-17 16:50:25 359
原创 Word Search DFS注意回溯
Word Search Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizo
2015-04-17 16:49:41 447
原创 Subsets 全排列问题
Subsets Given a set of distinct integers, S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not contain duplicate subsets
2015-04-17 16:47:36 516
原创 Combinations 全排列问题
Combinations Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.For example,If n = 4 and k = 2, a solution is:[ [2,4], [3,4], [2,3], [1,2]
2015-04-17 16:45:05 571
spring mybatis sql语句使用注解描述
2016-10-08
TA创建的收藏夹 TA关注的收藏夹
TA关注的人