摘要: 题目地址 The task is simple: given any positive integer N, you are supposed to count the total number of 1's in the decimal form of... 阅读全文
posted @ 2019-12-25 23:28 vincent's_blog 阅读(20) 评论(0) 推荐(0)
摘要: 题目地址 Given two strings S​1​​ and S​2​​ , S=S​1​​ −S​2​​ is defined to be the remaining string after taking all the characters i... 阅读全文
posted @ 2019-12-25 23:27 vincent's_blog 阅读(20) 评论(0) 推荐(0)
摘要: 题目地址 Given a non-empty tree with root R, and with weight W​i​​ assigned to each tree node T​i​​ . The weight of a path from R t... 阅读全文
posted @ 2019-12-25 23:26 vincent's_blog 阅读(24) 评论(0) 推荐(0)
摘要: 题目地址 A linked list consists of a series of structures, which are not necessarily adjacent in memory. We assume that each struct... 阅读全文
posted @ 2019-12-25 23:26 vincent's_blog 阅读(17) 评论(0) 推荐(0)
摘要: 题目地址 Given a stack which can keep M numbers at most. Push N numbers in the order of 1, 2, 3, ..., N and pop randomly. You are s... 阅读全文
posted @ 2019-12-25 23:26 vincent's_blog 阅读(14) 评论(0) 推荐(0)
摘要: 题目地址 Behind the scenes in the computer's memory, color is always talked about as a series of 24 bits of information for each pi... 阅读全文
posted @ 2019-12-25 23:24 vincent's_blog 阅读(29) 评论(0) 推荐(0)
摘要: 题目地址 Forbes magazine publishes every year its list of billionaires based on the annual ranking of the world's wealthiest people... 阅读全文
posted @ 2019-12-25 23:23 vincent's_blog 阅读(13) 评论(0) 推荐(0)
摘要: 题目地址 Mice and Rice is the name of a programming contest in which each programmer must write a piece of code to control the move... 阅读全文
posted @ 2019-12-25 23:23 vincent's_blog 阅读(24) 评论(0) 推荐(0)
摘要: 题目地址 Stack is one of the most fundamental data structures, which is based on the principle of Last In First Out (LIFO). The bas... 阅读全文
posted @ 2019-12-25 23:22 vincent's_blog 阅读(20) 评论(0) 推荐(0)
摘要: 题目地址 If you are a fan of Harry Potter, you would know the world of magic has its own currency system -- as Hagrid explained it ... 阅读全文
posted @ 2019-12-25 23:22 vincent's_blog 阅读(29) 评论(0) 推荐(0)
摘要: 题目地址 Given any positive integer N, you are supposed to find all of its prime factors, and write them in the format N = p​1​​ ​k... 阅读全文
posted @ 2019-12-25 23:21 vincent's_blog 阅读(25) 评论(0) 推荐(0)
摘要: 题目地址 If a machine can save only 3 significant digits, the float numbers 12300 and 12358.9 are considered equal since they are b... 阅读全文
posted @ 2019-12-25 23:21 vincent's_blog 阅读(31) 评论(0) 推荐(0)
摘要: 题目地址 Sherlock Holmes received a note with some strange strings: Let's date! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscv... 阅读全文
posted @ 2019-12-25 23:20 vincent's_blog 阅读(30) 评论(0) 推荐(0)
摘要: 题目地址 About 900 years ago, a Chinese philosopher Sima Guang wrote a history book in which he talked about people's talent and vi... 阅读全文
posted @ 2019-12-25 23:20 vincent's_blog 阅读(37) 评论(0) 推荐(0)
摘要: 题目地址 Given two sets of integers, the similarity of the sets is defined to be N​c​​ /N​t​​ ×100%, where N​c​​ is the number of d... 阅读全文
posted @ 2019-12-25 23:19 vincent's_blog 阅读(19) 评论(0) 推荐(0)
摘要: 题目地址 A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties: The left subtree of... 阅读全文
posted @ 2019-12-25 23:18 vincent's_blog 阅读(22) 评论(0) 推荐(0)
摘要: 题目地址 Given three integers A, B and C in [−2​63​​ ,2​63​​ ], you are supposed to tell whether A+B>C. Input Specification:The fir... 阅读全文
posted @ 2019-12-25 23:18 vincent's_blog 阅读(20) 评论(0) 推荐(0)
摘要: 题目地址An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node diff... 阅读全文
posted @ 2019-12-25 23:17 vincent's_blog 阅读(24) 评论(0) 推荐(0)
摘要: 题目地址 Given any permutation of the numbers {0, 1, 2,..., N−1}, it is easy to sort them in increasing order. But what if Swap(0, ... 阅读全文
posted @ 2019-12-25 23:17 vincent's_blog 阅读(22) 评论(0) 推荐(0)
摘要: 题目地址 Eva loves to collect coins from all over the universe, including some other planets like Mars. One day she visited a unive... 阅读全文
posted @ 2019-12-25 23:16 vincent's_blog 阅读(44) 评论(0) 推荐(0)
摘要: 题目地址 For any 4-digit integer except the ones with all the digits being the same, if we sort the digits in non-increasing order ... 阅读全文
posted @ 2019-12-25 23:15 vincent's_blog 阅读(33) 评论(0) 推荐(0)
摘要: 题目地址 Mooncake is a Chinese bakery product traditionally eaten during the Mid-Autumn Festival. Many types of fillings and crusts... 阅读全文
posted @ 2019-12-25 23:15 vincent's_blog 阅读(30) 评论(0) 推荐(0)
摘要: 题目地址 People often have a preference among synonyms of the same word. For example, some may prefer "the police", while others ma... 阅读全文
posted @ 2019-12-25 23:14 vincent's_blog 阅读(13) 评论(0) 推荐(0)
摘要: 题目地址 A gas station has to be built at such a location that the minimum distance between the station and any of the residential ... 阅读全文
posted @ 2019-12-25 23:14 vincent's_blog 阅读(24) 评论(0) 推荐(0)
摘要: 题目地址 Scientific notation is the way that scientists easily handle very large numbers or very small numbers. The notation matche... 阅读全文
posted @ 2019-12-25 23:13 vincent's_blog 阅读(32) 评论(0) 推荐(0)
摘要: 题目地址 Given a constant K and a singly linked list L, you are supposed to reverse the links of every K elements on L. For example... 阅读全文
posted @ 2019-12-25 23:12 vincent's_blog 阅读(19) 评论(0) 推荐(0)
摘要: 题目地址 The ranklist of PAT is generated from the status list, which shows the scores of the submissions. This time you are suppos... 阅读全文
posted @ 2019-12-25 23:12 vincent's_blog 阅读(27) 评论(0) 推荐(0)
摘要: 题目地址 Weibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other use... 阅读全文
posted @ 2019-12-25 23:11 vincent's_blog 阅读(38) 评论(0) 推荐(0)
摘要: 题目地址 The Japanese language is notorious for its sentence ending particles. Personal preference of such particles can be conside... 阅读全文
posted @ 2019-12-25 23:11 vincent's_blog 阅读(20) 评论(0) 推荐(0)
摘要: 题目地址 The task of this problem is simple: insert a sequence of distinct positive integers into a hash table, and output the posi... 阅读全文
posted @ 2019-12-25 23:10 vincent's_blog 阅读(44) 评论(0) 推荐(0)
摘要: 题目地址 It is said that in 2011, there are about 100 graduate schools ready to proceed over 40,000 applications in Zhejiang Provin... 阅读全文
posted @ 2019-12-25 23:09 vincent's_blog 阅读(33) 评论(0) 推荐(0)
摘要: 题目地址A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a produ... 阅读全文
posted @ 2019-12-25 23:09 vincent's_blog 阅读(38) 评论(0) 推荐(0)
摘要: 题目地址 Given an integer with no more than 9 digits, you are supposed to read it in the traditional Chinese way. Output Fu first i... 阅读全文
posted @ 2019-12-25 23:08 vincent's_blog 阅读(30) 评论(0) 推荐(0)
摘要: 题目地址 Given N rational numbers in the form numerator/denominator, you are supposed to calculate their sum. Input Specification:E... 阅读全文
posted @ 2019-12-25 23:08 vincent's_blog 阅读(21) 评论(0) 推荐(0)
摘要: 题目地址 Given a list of N student records with name, ID and grade. You are supposed to sort the records with respect to the grade ... 阅读全文
posted @ 2019-12-25 23:07 vincent's_blog 阅读(20) 评论(0) 推荐(0)
摘要: On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters corresponding to those keys... 阅读全文
posted @ 2019-12-25 23:06 vincent's_blog 阅读(31) 评论(0) 推荐(0)
摘要: 题目地址 Given a sequence of positive integers and another positive integer p. The sequence is said to be a perfect sequence if M≤m... 阅读全文
posted @ 2019-12-25 23:06 vincent's_blog 阅读(17) 评论(0) 推荐(0)
摘要: 题目地址 Indeed there are many different tourist routes from our city to Rome. You are supposed to find your clients the route with... 阅读全文
posted @ 2019-12-25 23:05 vincent's_blog 阅读(41) 评论(0) 推荐(0)
摘要: 题目地址 An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a ... 阅读全文
posted @ 2019-12-25 23:05 vincent's_blog 阅读(24) 评论(0) 推荐(0)
摘要: 题目地址 For two rational numbers, your task is to implement the basic arithmetics, that is, to calculate their sum, difference, pr... 阅读全文
posted @ 2019-12-25 23:04 vincent's_blog 阅读(29) 评论(0) 推荐(0)
摘要: 题目地址 According to Wikipedia: Insertion sort iterates, consuming one input element each repetition, and growing a sorted output ... 阅读全文
posted @ 2019-12-25 23:03 vincent's_blog 阅读(25) 评论(0) 推荐(0)
摘要: 题目地址 A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a produ... 阅读全文
posted @ 2019-12-25 23:03 vincent's_blog 阅读(32) 评论(0) 推荐(0)
摘要: 题目地址 One important factor to identify acute stroke (急性脑卒中) is the volume of the stroke core. Given the results of image analysi... 阅读全文
posted @ 2019-12-25 23:02 vincent's_blog 阅读(25) 评论(0) 推荐(0)
摘要: 题目地址 Eva would like to make a string of beads with her favorite colors so she went to a small shop to buy some beads. There wer... 阅读全文
posted @ 2019-12-25 23:01 vincent's_blog 阅读(28) 评论(0) 推荐(0)
摘要: 题目地址 The string APPAPT contains two PAT's as substrings. The first one is formed by the 2nd, the 4th, and the 6th characters, a... 阅读全文
posted @ 2019-12-25 22:57 vincent's_blog 阅读(7) 评论(0) 推荐(0)
摘要: 题目地址 A family hierarchy is usually presented by a pedigree tree where all the nodes on the same level belong to the same genera... 阅读全文
posted @ 2019-12-25 22:57 vincent's_blog 阅读(25) 评论(0) 推荐(0)
摘要: 题目地址 Zhejiang University has 8 campuses and a lot of gates. From each gate we can collect the in/out times and the plate number... 阅读全文
posted @ 2019-12-25 22:56 vincent's_blog 阅读(33) 评论(0) 推荐(0)
摘要: 题目地址 Among all the factors of a positive integer N, there may exist several consecutive numbers. For example, 630 can be factor... 阅读全文
posted @ 2019-12-25 22:56 vincent's_blog 阅读(25) 评论(0) 推荐(0)
摘要: 题目地址 Given a singly linked list L with integer keys, you are supposed to remove the nodes with duplicated absolute values of th... 阅读全文
posted @ 2019-12-25 22:55 vincent's_blog 阅读(25) 评论(0) 推荐(0)
摘要: 题目地址 According to Wikipedia: Insertion sort iterates, consuming one input element each repetition, and growing a sorted output ... 阅读全文
posted @ 2019-12-25 22:54 vincent's_blog 阅读(28) 评论(0) 推荐(0)
摘要: 题目地址 A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties: The left subtree of... 阅读全文
posted @ 2019-12-25 22:54 vincent's_blog 阅读(27) 评论(0) 推荐(0)
摘要: 题目地址 People on Mars count their numbers with base 13: Zero on Earth is called "tret" on Mars.The numbers 1 to 12 on Earth is ca... 阅读全文
posted @ 2019-12-25 22:53 vincent's_blog 阅读(36) 评论(0) 推荐(0)
摘要: 题目地址 There is a classical process named partition in the famous quick sort algorithm. In this process we typically choose one e... 阅读全文
posted @ 2019-12-25 22:52 vincent's_blog 阅读(21) 评论(0) 推荐(0)
摘要: 题目地址 The following is from Max Howell @twitter: Google: 90% of our engineers use the software you wrote (Homebrew), but you can... 阅读全文
posted @ 2019-12-25 22:51 vincent's_blog 阅读(20) 评论(0) 推荐(0)
摘要: 题目地址 The K−P factorization of a positive integer N is to write N as the sum of the P-th power of K positive integers. You are s... 阅读全文
posted @ 2019-12-25 22:50 vincent's_blog 阅读(27) 评论(0) 推荐(0)
摘要: 题目地址 Given a sequence of positive numbers, a segment is defined to be a consecutive subsequence. For example, given the sequenc... 阅读全文
posted @ 2019-12-25 22:50 vincent's_blog 阅读(23) 评论(0) 推荐(0)
摘要: 题目地址 This time your job is to fill a sequence of N positive integers into a spiral matrix in non-increasing order. A spiral mat... 阅读全文
posted @ 2019-12-25 22:49 vincent's_blog 阅读(23) 评论(0) 推荐(0)
摘要: 题目地址 A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a produ... 阅读全文
posted @ 2019-12-25 22:48 vincent's_blog 阅读(46) 评论(0) 推荐(0)
摘要: 题目地址 When register on a social network, you are always asked to specify your hobbies in order to find some potential friends wi... 阅读全文
posted @ 2019-12-25 22:48 vincent's_blog 阅读(23) 评论(0) 推荐(0)
摘要: 请输入链接描述 The basic task is simple: given N real numbers, you are supposed to calculate their average. But what makes it complica... 阅读全文
posted @ 2019-12-25 22:47 vincent's_blog 阅读(20) 评论(0) 推荐(0)
摘要: 题目地址 Formation is very important when taking a group photo. Given the rules of forming K rows with N people as the following: T... 阅读全文
posted @ 2019-12-25 22:47 vincent's_blog 阅读(25) 评论(0) 推荐(0)
摘要: 题目地址 Given a tree, you are supposed to tell if it is a complete binary tree. Input Specification:Each input file contains one t... 阅读全文
posted @ 2019-12-25 22:46 vincent's_blog 阅读(25) 评论(0) 推荐(0)
摘要: 题目地址 Input our current position and a destination, an online map can recommend several paths. Now your job is to recommend two ... 阅读全文
posted @ 2019-12-25 22:45 vincent's_blog 阅读(23) 评论(0) 推荐(0)
摘要: 题目地址 On a broken keyboard, some of the keys are always stucked. So when you type some sentences, the characters corresponding t... 阅读全文
posted @ 2019-12-25 22:45 vincent's_blog 阅读(34) 评论(0) 推荐(0)
摘要: 题目地址 Given a set of N (>1) positive integers, you are supposed to partition them into two disjoint sets A​1​​ and A​2​​ of n​1​... 阅读全文
posted @ 2019-12-25 22:44 vincent's_blog 阅读(32) 评论(0) 推荐(0)
摘要: 题目地址 This time, you are supposed to help us collect the data for family-owned property. Given each person's family members, and... 阅读全文
posted @ 2019-12-25 22:43 vincent's_blog 阅读(24) 评论(0) 推荐(0)
摘要: 题目地址 "Let's C" is a popular and fun programming contest hosted by the College of Computer Science and Technology, Zhejiang Univ... 阅读全文
posted @ 2019-12-25 22:42 vincent's_blog 阅读(16) 评论(0) 推荐(0)
摘要: 题目地址 A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties: The left subtree of... 阅读全文
posted @ 2019-12-25 22:42 vincent's_blog 阅读(27) 评论(0) 推荐(0)
摘要: 题目地址 British astronomer Eddington liked to ride a bike. It is said that in order to show off his skill, he has even defined an ... 阅读全文
posted @ 2019-12-25 22:41 vincent's_blog 阅读(18) 评论(0) 推荐(0)
摘要: 题目地址 Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can be determined by a giv... 阅读全文
posted @ 2019-12-25 22:40 vincent's_blog 阅读(38) 评论(0) 推荐(0)
摘要: 题目地址 Some scientists took pictures of thousands of birds in a forest. Assume that all the birds appear in the same picture belo... 阅读全文
posted @ 2019-12-25 22:40 vincent's_blog 阅读(31) 评论(0) 推荐(0)
摘要: 题目地址 Two integers are called "friend numbers" if they share the same sum of their digits, and the sum is their "friend ID". For... 阅读全文
posted @ 2019-12-25 22:39 vincent's_blog 阅读(22) 评论(0) 推荐(0)
摘要: 题目地址 "Damn Single (单身狗)" is the Chinese nickname for someone who is being single. You are supposed to find those who are alone ... 阅读全文
posted @ 2019-12-25 22:38 vincent's_blog 阅读(33) 评论(0) 推荐(0)
摘要: 题目地址 The "Hamilton cycle problem" is to find a simple cycle that contains every vertex in a graph. Such a cycle is called a "Ha... 阅读全文
posted @ 2019-12-25 22:37 vincent's_blog 阅读(48) 评论(0) 推荐(0)
摘要: 题目地址An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node diff... 阅读全文
posted @ 2019-12-25 22:36 vincent's_blog 阅读(37) 评论(0) 推荐(0)
摘要: 题目地址 John got a full mark on PAT. He was so happy that he decided to hold a raffle(抽奖) for his followers on Weibo -- that is, he... 阅读全文
posted @ 2019-12-25 22:34 vincent's_blog 阅读(29) 评论(0) 推荐(0)
摘要: 题目地址Given some segments of rope, you are supposed to chain them into one rope. Each time you may only fold two segments into lo... 阅读全文
posted @ 2019-12-25 22:33 vincent's_blog 阅读(20) 评论(0) 推荐(0)
摘要: 题目地址In graph theory, an Eulerian path is a path in a graph which visits every edge exactly once. Similarly, an Eulerian circui... 阅读全文
posted @ 2019-12-25 22:33 vincent's_blog 阅读(27) 评论(0) 推荐(0)
摘要: 题目地址 Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can be determined by a giv... 阅读全文
posted @ 2019-12-25 22:32 vincent's_blog 阅读(35) 评论(0) 推荐(0)
摘要: 题目地址 The "eight queens puzzle" is the problem of placing eight chess queens on an 8×8 chessboard so that no two queens threaten... 阅读全文
posted @ 2019-12-25 22:31 vincent's_blog 阅读(33) 评论(0) 推荐(0)
摘要: 题目地址 Recommendation system predicts the preference that a user would give to an item. Now you are asked to program a very simpl... 阅读全文
posted @ 2019-12-25 22:30 vincent's_blog 阅读(24) 评论(0) 推荐(0)
摘要: 题目地址 Given a syntax tree (binary), you are supposed to output the corresponding infix expression, with parentheses reflecting t... 阅读全文
posted @ 2019-12-25 22:29 vincent's_blog 阅读(25) 评论(0) 推荐(0)
摘要: 题目地址 In the big cities, the subway systems always look so complex to the visitors. To give you some sense, the following figure... 阅读全文
posted @ 2019-12-25 22:28 vincent's_blog 阅读(32) 评论(0) 推荐(0)
摘要: 题目地址Given a singly linked list, you are supposed to rearrange its elements so that all the negative values appear before all o... 阅读全文
posted @ 2019-12-25 22:26 vincent's_blog 阅读(25) 评论(0) 推荐(0)
摘要: 题目地址Cutting an integer means to cut a K digits lone integer Z into two integers of (K/2) digits long integers A and B. For exa... 阅读全文
posted @ 2019-12-25 22:26 vincent's_blog 阅读(24) 评论(0) 推荐(0)
摘要: 题目地址 A vertex cover of a graph is a set of vertices such that each edge of the graph is incident to at least one vertex of the ... 阅读全文
posted @ 2019-12-25 22:25 vincent's_blog 阅读(25) 评论(0) 推荐(0)
摘要: 题目地址 There is a kind of balanced binary search tree named red-black tree in the data structure. It has the following 5 properti... 阅读全文
posted @ 2019-12-25 22:23 vincent's_blog 阅读(40) 评论(0) 推荐(0)
摘要: 题目地址 Consider a positive integer N written in standard notation with k+1 digits a​i​​ as a​k​​ ⋯a​1​​ a​0​​ with 0≤a​i​​ 0. The... 阅读全文
posted @ 2019-12-25 22:21 vincent's_blog 阅读(24) 评论(0) 推荐(0)
摘要: 题目地址 For a student taking the online course "Data Structures" on China University MOOC (http://www.icourse163.org/), to be qual... 阅读全文
posted @ 2019-12-25 22:20 vincent's_blog 阅读(25) 评论(0) 推荐(0)
摘要: 题目地址 Suppose that all the keys in a binary tree are distinct positive integers. Given the preorder and inorder traversal sequen... 阅读全文
posted @ 2019-12-25 22:19 vincent's_blog 阅读(20) 评论(0) 推荐(0)
摘要: 题目地址 Unlike in nowadays, the way that boys and girls expressing their feelings of love was quite subtle in the early years. Whe... 阅读全文
posted @ 2019-12-25 22:19 vincent's_blog 阅读(32) 评论(0) 推荐(0)
摘要: 题目地址Look-and-say sequence is a sequence of integers as the following: D, D1, D111, D113, D11231, D112213111, ... where D is in ... 阅读全文
posted @ 2019-12-25 22:18 vincent's_blog 阅读(24) 评论(0) 推荐(0)
摘要: 题目地址 After each PAT, the PAT Center will announce the ranking of institutions based on their students' performances. Now you ar... 阅读全文
posted @ 2019-12-25 22:17 vincent's_blog 阅读(27) 评论(0) 推荐(0)
摘要: 题目地址 A clique is a subset of vertices of an undirected graph such that every two distinct vertices in the clique are adjacent. ... 阅读全文
posted @ 2019-12-25 22:16 vincent's_blog 阅读(27) 评论(0) 推荐(0)
摘要: 题目地址 The lowest common ancestor (LCA) of two nodes U and V in a tree is the deepest node that has both U and V as descendants. ... 阅读全文
posted @ 2019-12-25 22:15 vincent's_blog 阅读(24) 评论(0) 推荐(0)
摘要: 题目地址 Given N integers, you are supposed to find the smallest positive integer that is NOT in the given list. Input Specificatio... 阅读全文
posted @ 2019-12-25 22:14 vincent's_blog 阅读(33) 评论(0) 推荐(0)
摘要: 题目地址 The task of this problem is simple: insert a sequence of distinct positive integers into a hash table first. Then try to f... 阅读全文
posted @ 2019-12-25 22:13 vincent's_blog 阅读(26) 评论(0) 推荐(0)
摘要: 题目地址 This is a problem given in the Graduate Entrance Exam in 2018: Which of the following is NOT a topological order obtained ... 阅读全文
posted @ 2019-12-25 22:11 vincent's_blog 阅读(30) 评论(0) 推荐(0)
摘要: 题目地址 In computer science, a heap is a specialized tree-based data structure that satisfies the heap property: if P is a parent ... 阅读全文
posted @ 2019-12-25 22:09 vincent's_blog 阅读(38) 评论(0) 推荐(0)
摘要: 题目地址 Werewolf(狼人杀) is a game in which the players are partitioned into two parties: the werewolves and the human beings. Suppos... 阅读全文
posted @ 2019-12-25 22:08 vincent's_blog 阅读(47) 评论(0) 推荐(0)