04 2020 档案
摘要:The ranklist of PAT is generated from the status list, which shows the scores of the submissions. This time you are supposed to generate the ranklist
阅读全文
摘要:Weibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other users as well. Hence a social n
阅读全文
摘要:The Japanese language is notorious for its sentence ending particles. Personal preference of such particles can be considered as a reflection of the s
阅读全文
摘要:The task of this problem is simple: insert a sequence of distinct positive integers into a hash table, and output the positions of the input numbers.
阅读全文
摘要:A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer
阅读全文
摘要:It is said that in 2011, there are about 100 graduate schools ready to proceed over 40,000 applications in Zhejiang Province. It would help a lot if y
阅读全文
摘要:Given N rational numbers in the form numerator/denominator, you are supposed to calculate their sum. Input Specification: Each input file contains one
阅读全文
摘要:Given an integer with no more than 9 digits, you are supposed to read it in the traditional Chinese way. Output Fu first if it is negative. For exampl
阅读全文
摘要:Given a list of N student records with name, ID and grade. You are supposed to sort the records with respect to the grade in non-increasing order, and
阅读全文
摘要:There is a classical process named partition in the famous quick sort algorithm. In this process we typically choose one element as the pivot. Then th
阅读全文
摘要: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
阅读全文
摘要: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 supposed to write a program t
阅读全文
摘要:Given a sequence of positive numbers, a segment is defined to be a consecutive subsequence. For example, given the sequence { 0.1, 0.2, 0.3, 0.4 }, we
阅读全文
摘要: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 fi
阅读全文
摘要:A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer
阅读全文
摘要: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 socia
阅读全文
摘要:The basic task is simple: given N real numbers, you are supposed to calculate their average. But what makes it complicated is that some of the input n
阅读全文
摘要:Given a tree, you are supposed to tell if it is a complete binary tree. Input Specification: Each input file contains one test case. For each case, th
阅读全文
摘要:Input our current position and a destination, an online map can recommend several paths. Now your job is to recommend two paths to your user: one is t
阅读全文
摘要:On a broken keyboard, some of the keys are always stucked. So when you type some sentences, the characters corresponding to those keys will appear rep
阅读全文
摘要:Given a set of N (>) positive integers, you are supposed to partition them into two disjoint sets A1 and A2 of n1 and n2 numbers, respecti
阅读全文
摘要:This time, you are supposed to help us collect the data for family-owned property. Given each person's family members, and the estate(房产)info under hi
阅读全文
摘要: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
阅读全文
摘要:"Let's C" is a popular and fun programming contest hosted by the College of Computer Science and Technology, Zhejiang University. Since the idea of th
阅读全文
摘要:British astronomer Eddington liked to ride a bike. It is said that in order to show off his skill, he has even defined an "Eddington number", E -- tha
阅读全文
摘要:Some scientists took pictures of thousands of birds in a forest. Assume that all the birds appear in the same picture belong to the same tree. You are
阅读全文
摘要:Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can be determined by a given pair of postorder and ino
阅读全文
摘要:Two integers are called "friend numbers" if they share the same sum of their digits, and the sum is their "friend ID". For example, 123 and 51 are fri
阅读全文
摘要:"Damn Single (单身狗)" is the Chinese nickname for someone who is being single. You are supposed to find those who are alone in a big party, so they can
阅读全文
摘要:The "Hamilton cycle problem" is to find a simple cycle that contains every vertex in a graph. Such a cycle is called a "Hamiltonian cycle". In this pr
阅读全文
摘要:An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node differ by at most one; if at any
阅读全文
摘要:Given three integers n, m and k. Consider the following algorithm to find the maximum element of an array of positive integers: You should build the a
阅读全文
摘要: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 would select winners from
阅读全文
摘要:Given some segments of rope, you are supposed to chain them into one rope. Each time you may only fold two segments into loops and chain them into one
阅读全文
摘要:In graph theory, an Eulerian path is a path in a graph which visits every edge exactly once. Similarly, an Eulerian circuit is an Eulerian path which
阅读全文
摘要:Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can be determined by a given pair of postorder and ino
阅读全文
摘要:The "eight queens puzzle" is the problem of placing eight chess queens on an 8 chessboard so that no two queens threaten each other. Thus, a solution
阅读全文
摘要:Recommendation system predicts the preference that a user would give to an item. Now you are asked to program a very simple recommendation system that
阅读全文
摘要:Given a syntax tree (binary), you are supposed to output the corresponding infix expression, with parentheses reflecting the precedences of the operat
阅读全文
摘要:In the big cities, the subway systems always look so complex to the visitors. To give you some sense, the following figure shows the map of Beijing su
阅读全文
摘要: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 example, after cutting Z = 1673
阅读全文
摘要:Given a singly linked list, you are supposed to rearrange its elements so that all the negative values appear before all of the non-negatives, and all
阅读全文
摘要: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 set. Now given a graph with
阅读全文
摘要:There is a kind of balanced binary search tree named red-black tree in the data structure. It has the following 5 properties: (1) Every node is either
阅读全文
摘要:Consider a positive integer N written in standard notation with k+1 digits ai as ak⋯a1a0 with 0 for all i and ak>0. Then N is palindrom
阅读全文
摘要:For a student taking the online course "Data Structures" on China University MOOC (http://www.icourse163.org/), to be qualified for a certificate, he/
阅读全文
摘要:Suppose that all the keys in a binary tree are distinct positive integers. Given the preorder and inorder traversal sequences, you are supposed to out
阅读全文
摘要:Unlike in nowadays, the way that boys and girls expressing their feelings of love was quite subtle in the early years. When a boy A had a crush on a g
阅读全文
摘要:Look-and-say sequence is a sequence of integers as the following: D, D1, D111, D113, D11231, D112213111, ... where D is in [0, 9] except 1. The (n+1)s
阅读全文
摘要:After each PAT, the PAT Center will announce the ranking of institutions based on their students' performances. Now you are asked to generate the rank
阅读全文
摘要:A clique is a subset of vertices of an undirected graph such that every two distinct vertices in the clique are adjacent. A maximal clique is a clique
阅读全文
摘要: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. A binary search tree (BST) i
阅读全文
摘要:Given N integers, you are supposed to find the smallest positive integer that is NOT in the given list. Input Specification: Each input file contains
阅读全文
摘要:The task of this problem is simple: insert a sequence of distinct positive integers into a hash table first. Then try to find another sequence of inte
阅读全文
摘要:This is a problem given in the Graduate Entrance Exam in 2018: Which of the following is NOT a topological order obtained from the given directed grap
阅读全文
摘要:In computer science, a heap is a specialized tree-based data structure that satisfies the heap property: if P is a parent node of C, then the key (the
阅读全文
摘要:1408. String Matching in an Array Given an array of string words. Return all strings in words which is substring of another word in any order. String
阅读全文
摘要:Werewolf(狼人杀) is a game in which the players are partitioned into two parties: the werewolves and the human beings. Suppose that in a game, player #1
阅读全文
摘要:When shipping goods with containers, we have to be careful not to pack some incompatible goods into the same container, or we might get ourselves in s
阅读全文
摘要:The "travelling salesman problem" asks the following question: "Given a list of cities and the distances between each pair of cities, what is the shor
阅读全文
摘要: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. Given any two nodes in a bin
阅读全文
摘要:In July 2004, Google posted on a giant billboard along Highway 101 in Silicon Valley (shown in the picture below) for recruitment. The content is supe
阅读全文
摘要:经过连个小时的笔试考试真的发现自己的编码水平还是不行,感觉都是很简单的题,但是提交上去之后总是不能够AC,自己平时写代码也都是慢悠悠的写,没有注意过时间,经过这次的笔试,发现自己在规定的时间内写出一些没有bug代码,真的很难。 像第一题,我知道该怎么写,但是写的时候思路很混乱,有些特殊的时间点也考虑
阅读全文
摘要:RESTful调用和 RPC调用有什么区别?如果让你设计一个RPC服务治理框架你会设计那些模块?是否了解过Service Mesh,如果了解Service Mesh是用来解决什么问题的? 1、RESTful是一种软件架构风格,用于约束客户端和服务器交互,满足这些约束条件和原则的应用程序或设计就是 R
阅读全文
摘要:链接:https://www.nowcoder.com/questionTerminal/2e2510b2e41e4d3b922416e51afc077b来源:牛客网 给出两个字符串,分别是模式串P和目标串T,判断模式串和目标串是否匹配,匹配输出 1,不匹配输出 0。模式串中‘?’可以匹配目标串中的
阅读全文
摘要:给出一个布尔表达式的字符串,比如:true or false and false,表达式只包含true,false,and和or,现在要对这个表达式进行布尔求值,计算结果为真时输出true、为假时输出false,不合法的表达时输出error(比如:true true)。表达式求值是注意and 的优先
阅读全文
摘要:今天接到了美团的笔试邀请,毕竟是人生中的第一次,感觉挺开心的,但是开心的同时伴随而来的是担心,没什么经验,不知道笔试这一关能不能通过。编程提到还好,就是那些问答题我真的不知道该怎么回答,感觉一脸懵。趁着这两天时间,好好地补一下吧。不知道为什么突然感觉自己好像什么都不会。是不是自己把太多的精力放在了写
阅读全文
摘要:A registration card number of PAT consists of 4 parts: the 1st letter represents the test level, namely, T for the top level, A for advance and B for
阅读全文
摘要:A proper vertex coloring is a labeling of the graph's vertices with colors such that no two vertices sharing the same edge have the same color. A colo
阅读全文
摘要:In computer science, a heap is a specialized tree-based data structure that satisfies the heap property: if P is a parent node of C, then the key (the
阅读全文
摘要:On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters corresponding to those keys will not appear on sc
阅读全文
摘要:Given a sequence of positive integers and another positive integer p. The sequence is said to be a perfect sequence if M≤m×p where M and m are the max
阅读全文
摘要:An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-node binary tree (with the
阅读全文
摘要:Indeed there are many different tourist routes from our city to Rome. You are supposed to find your clients the route with the least cost while gainin
阅读全文
摘要:For two rational numbers, your task is to implement the basic arithmetics, that is, to calculate their sum, difference, product and quotient. Input Sp
阅读全文
摘要:According to Wikipedia: Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insert
阅读全文
摘要:A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer
阅读全文
摘要: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
阅读全文
摘要: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 were many colorful strings of b
阅读全文
摘要:The string APPAPT contains two PAT's as substrings. The first one is formed by the 2nd, the 4th, and the 6th characters, and the second one is formed
阅读全文
摘要: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 t
阅读全文
摘要:Zhejiang University has 8 campuses and a lot of gates. From each gate we can collect the in/out times and the plate numbers of the cars crossing the g
阅读全文
摘要:Among all the factors of a positive integer N, there may exist several consecutive numbers. For example, 630 can be factored as 3×5×6×7, where 5, 6, a
阅读全文
摘要:Given a singly linked list L with integer keys, you are supposed to remove the nodes with duplicated absolute values of the keys. That is, for each va
阅读全文