- 博客(7)
- 资源 (4)
- 收藏
- 关注
原创 [C++] LeetCode 31. 下一个排列
题目实现获取下一个排列函数,这个算法需要将数字重新排列成字典序中数字更大的排列。如果不存在更大的排列,则重新将数字排列成最小的排列(即升序排列)。修改必须是原地的,不开辟额外的内存空间。这是一些例子,输入位于左侧列,其相应输出位于右侧列。1,2,3 → 1,3,23,2,1 → 1,2,31,1,5 → 1,5,1解析获取下一个全排列,如果想偷懒可以直接用函...
2018-03-31 12:54:46 2227
原创 [C++] LeetCode 17. 电话号码的字母组合
题目给定一个数字字符串,返回数字所有可能表示的字母组合。 下面给出数字到字母的映射(和电话号码一样)。 输入:数字字符串 “23” 输出:[“ad”, “ae”, “af”, “bd”, “be”, “bf”, “cd”, “ce”, “cf”].说明: 尽管上面的答案是按字典序排列的,但是你的答案可以是任何顺序。代码class Solution {public:...
2018-03-31 11:37:03 2390 2
原创 [PAT] C++ 1141. PAT Ranking of Institutions (25)
题目After each PAT, the PAT Center will announce the ranking of institutions based on their students’ performances. Now you are asked to generate the ranklist.Input Specification:Each input file c...
2018-03-18 22:13:48 560
原创 [PAT] C++ 1142. Maximal Clique (25)
题目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 that cannot be extended by including one more...
2018-03-18 22:10:59 839
原创 [PAT] C++ 1140. Look-and-say Sequence (20)
题目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)st number is a kind of description of the nth n...
2018-03-18 22:06:04 288
原创 [PAT] c++ 1143. Lowest Common Ancestor (30)
题目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) is recursively defined as a binary tree which ...
2018-03-18 22:03:07 1956
原创 [PAT][ C++] 1026. Table Tennis (30)
题目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 when they arrive, they will be assigned to the...
2018-03-04 14:30:04 387
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人