摘要:1076 Forwards on Weibo Weibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other users as
阅读全文
摘要:1034 Head of a Gang 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 sa
阅读全文
摘要:1013 Battle Over Cities 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 hig
阅读全文
摘要:1021 Deepest Root 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 su
阅读全文
摘要:1022 Digital Library A Digital Library contains millions of books, stored according to their titles, authors, key words of their abstracts, publishers
阅读全文
摘要:1071 Speech Patterns People often have a preference among synonyms of the same word. For example, some may prefer "the police", while others may prefe
阅读全文
摘要:1100 Mars Numbers People on Mars count their numbers with base 13: Zero on Earth is called “tret” on Mars. The numbers 1 to 12 on Earch is called “jan
阅读全文
摘要:1060 Are They Equal If a machine can save only 3 significant digits, the float numbers 12300 and 12358.9 are considered equal since they are both save
阅读全文
摘要:1063 Set Similarity Given two sets of integers, the similarity of the sets is defined to be Nc/Nt*100%, where Nc is the number of distinct common numb
阅读全文
摘要:1047 Student List for Course Zhejiang University has 40,000 students and provides 2,500 courses. Now given the registered course list of each student,
阅读全文
摘要:1053 Path of Equal Weight 给定一个非空的树,树根为 RR。 树中每个节点 TiTi 的权重为 WiWi。 从 RR 到 LL 的路径权重定义为从根节点 RR 到任何叶节点 LL 的路径中包含的所有节点的权重之和。 现在给定一个加权树以及一个给定权重数字,请你找出树中所有的权
阅读全文
摘要:1004 Counting Leaves A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child. Input Sp
阅读全文
摘要:1094 The Largest Generation A family hierarchy is usually presented by a pedigree tree where all the nodes on the same level belong to the same genera
阅读全文
摘要:1090 Highest Price in Supply Chain A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving
阅读全文
摘要:1079 Total Sales of Supply Chain A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)– everyone involved in moving a p
阅读全文
摘要:1102 Invert a Binary Tree The following is from Max Howell @twitter: Google: 90% of our engineers use the software you wrote (Homebrew), but you can’t
阅读全文
摘要:1086 Tree Traversals Again An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6
阅读全文
摘要:1020 Tree Traversals Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, y
阅读全文
摘要:1098 Insertion or Heap Sort According to Wikipedia: Insertion sort iterates, consuming one input element each repetition, and growing a sorted output
阅读全文
摘要:1107 Social Clusters When register on a social network, you are always asked to specify your hobbies in order to find some potential friends with the
阅读全文