- 博客(24)
- 收藏
- 关注
原创 1034 Head of a Gang (30分)DFS+并查集
文章目录解决方法题目大意解题方法DFS并查集后记One way that the police finds the head of a gang is to check people’s phone calls. If there is a phone call between A and B, we say that A and B is related. The weight of a re...
2020-04-30 11:29:08 122
原创 1013 Battle Over Cities (25分)
文章目录问题解决方法题目大意dfs并查集问题It is vitally important to have all the cities connected by highways in a war. If a city is occupied by the enemy, all the highways from/toward that city are closed. We must kn...
2020-04-28 21:19:30 124
原创 1040 Longest Symmetric String (25分)
文章目录问题解决方法题目大意思路暴力解法马拉车问题Given a string, you are supposed to output the length of the longest symmetric sub-string. For example, given Is PAT&TAP symmetric?, the longest symmetric sub-string is ...
2020-04-25 17:13:15 131
原创 1057 Stack (30分)
文章目录问题解决方法后记问题Stack is one of the most fundamental data structures, which is based on the principle of Last In First Out (LIFO). The basic operations include Push (inserting an element onto the top ...
2020-04-22 20:19:03 107
原创 1014 Waiting in Line (30分)
文章目录问题解决方法题目大意思路后记问题Suppose a bank has N windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. The rules for the customers to wait i...
2020-04-22 10:55:46 179
原创 1017 Queueing at Bank (25分)
文章目录问题解决方法题目大意第一次代码思路第二次代码(更好)思路后记问题Suppose a bank has K windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. All the customers hav...
2020-04-21 09:51:35 93
原创 1105 Spiral Matrix (25分)
问题This time your job is to fill a sequence of N positive integers into a spiral matrix in non-increasing order. A spiral matrix is filled in from the first element at the upper-left corner, then move...
2020-04-20 23:57:55 145
原创 1057 Stack (30分)
文章目录问题问题1057 Stack (30分)Stack is one of the most fundamental data structures, which is based on the principle of Last In First Out (LIFO). The basic operations include Push (inserting an element on...
2020-04-11 10:02:04 70
原创 1045 Favorite Color Stripe (30分)
文章目录问题解决方法后记问题1045 Favorite Color Stripe (30分)Eva is trying to make her own color stripe out of a given one. She would like to keep only her favorite colors in her favorite order by cutting off tho...
2020-04-10 19:22:29 150
原创 1007 Maximum Subsequence Sum (25分)
文章目录问题解决方法后记问题Given a sequence of K integers { N1, N2, …, NK }. A continuous subsequence is defined to be { Ni, Ni+1, …, Nj } where 1≤i≤j≤K. The Maximum Subsequence is the continuo...
2020-04-10 18:23:20 94
原创 1021 Deepest Root (25分)
文章目录问题解决方法问题A graph which is connected and acyclic can be considered a tree. The height of the tree depends on the selected root. Now you are supposed to find the root that results in a highest tree...
2020-04-10 16:41:35 72
原创 1013 Battle Over Cities (25分)
文章目录问题解决方法dfs并查集后记问题It is vitally important to have all the cities connected by highways in a war. If a city is occupied by the enemy, all the highways from/toward that city are closed. We must know...
2020-04-10 10:16:45 80
原创 1107 Social Clusters (30分)
文章目录问题解决方法后记问题When register on a social network, you are always asked to specify your hobbies in order to find some potential friends with the same hobbies. A social cluster is a set of people who h...
2020-04-08 12:35:56 104
原创 1099 Build A Binary Search Tree (30分)
文章目录问题解决方法后记问题A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only nodes with keys less than the node's key...
2020-04-07 15:07:50 112
原创 1064 Complete Binary Search Tree (30分)
文章目录问题解决方法问题A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only nodes with keys less than the node's key....
2020-04-07 13:33:41 107
原创 1043 Is It a Binary Search Tree (25分)
文章目录问题解决方法后记问题A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only nodes with keys less than the node's key...
2020-04-07 13:31:13 90
原创 1053 Path of Equal Weight (30分)
文章目录问题解决方法后记问题Given a non-empty tree with root R, and with weight Wi assigned to each tree node Ti. The weight of a path from R to L is defined to be the sum of the weights of all the nodes al...
2020-04-05 13:20:14 87
原创 1004 Counting Leaves (30分)
文章目录问题解决方法后记问题A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child.Input Specification:Each input file contains one test case. Ea...
2020-04-05 11:47:45 97
原创 1106 Lowest Price in Supply Chain (25分)
文章目录问题解决方法后记问题A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer.Starting from one root supplier,...
2020-04-04 16:01:01 177
原创 1094 The Largest Generation (25分)
文章目录问题解决方法后记问题A family hierarchy is usually presented by a pedigree tree where all the nodes on the same level belong to the same generation. Your task is to find the generation with the largest pop...
2020-04-04 12:55:02 140
原创 1079 Total Sales of Supply Chain (25分)
文章目录问题解决方法后记问题A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer.Starting from one root supplier,...
2020-04-04 12:11:36 92
原创 1090 Highest Price in Supply Chain (25分)
文章目录问题解决方法queuedfs后记问题1090 Highest Price in Supply Chain (25分)A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from suppl...
2020-04-03 21:47:46 134
原创 1102 Invert a Binary Tree (25分)
文章目录问题解决方法后记问题The following is from Max Howell @twitter:Google: 90% of our engineers use the software you wrote (Homebrew), but you can’t invert a binary tree on a whiteboard so fuck off.Now it’s ...
2020-04-03 15:59:22 55
原创 1091 Acute Stroke (30分)
文章目录问题解决方法后记问题One important factor to identify acute stroke (急性脑卒中) is the volume of the stroke core. Given the results of image analysis in which the core regions are identified in each MRI slice, ...
2020-04-02 19:46:58 95
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人