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 ...
1152 Google Recruitment
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 ...
1153 Decode Registration Card of PAT
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 ...
1065 A+B and C (64bit)
Given three integers A, B and C in [−2^63^,2^63^], you are supposed to tell whether A+B>C. Input Specification:The first line of the input gives the p ...
1006 Sign In and Sign Out
At the beginning of every day, the first person who signs in the computer room will unlock the door, and the last one who signs out will lock the door ...
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 Specification:Each inpu ...
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 generation. Your task is to find t ...
1154 Vertex Coloring
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 ...
1155 Heap Paths
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 ...
1057 Stack
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 ( ...