摘要: 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 阅读全文
posted @ 2018-09-02 18:12 赖兴宇 阅读(248) 评论(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, *)is the ONLY operation that 阅读全文
posted @ 2018-09-02 18:06 赖兴宇 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 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 ( 阅读全文
posted @ 2018-09-02 18:02 赖兴宇 阅读(137) 评论(0) 推荐(0) 编辑
摘要: A table tennis club has N tables available to the public. The tables are numbered from 1 to N. For any pair of players, if there are some tables open 阅读全文
posted @ 2018-09-02 17:56 赖兴宇 阅读(305) 评论(0) 推荐(1) 编辑
摘要: 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 c 阅读全文
posted @ 2018-09-02 16:21 赖兴宇 阅读(177) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2018-09-02 15:13 赖兴宇 阅读(701) 评论(0) 推荐(0) 编辑
摘要: Given an increasing sequence S of N integers, the median is the number at the middle position. For example, the median of S1 = { 11, 12, 13, 14 } is 1 阅读全文
posted @ 2018-09-02 11:15 赖兴宇 阅读(340) 评论(0) 推荐(0) 编辑
摘要: A long-distance telephone company charges its customers by the following rules: Making a long-distance call costs a certain amount per minute, dependi 阅读全文
posted @ 2018-09-02 10:35 赖兴宇 阅读(185) 评论(0) 推荐(0) 编辑
摘要: Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is yes, if 6 is a decimal number and 110 is a 阅读全文
posted @ 2018-09-02 09:10 赖兴宇 阅读(188) 评论(0) 推荐(0) 编辑