- 博客(7)
- 收藏
- 关注
原创 Leetcode第33题目:搜索旋转排序数组
Leetcode第33题目:搜索旋转排序数组整数数组 nums 按升序排列,数组中的值 互不相同 。在传递给函数之前,nums 在预先未知的某个下标 k(0 <= k < nums.length)上进行了 旋转,使数组变为 [nums[k], nums[k+1], …, nums[n-1], nums[0], nums[1], …, nums[k-1]](下标 从 0 开始 计数)。例如, [0,1,2,4,5,6,7] 在下标 3 处经旋转后可能变为 [4,5,6,7,0,1,2] 。给
2022-04-05 20:15:46
166
原创 大数运算——求阶乘
大数运算——求阶乘计算较为大的数字的阶乘使用的方法主要是利用一个辅助存储空间(数组)用于保存两个数字相乘后的每一位的结果。运算的原理就是小学学过的两位数乘法列竖式的每一位的计算过程,实际上就是将一个非常大的数字的乘法换成了两个小数相乘后再相加的过程,需要反复多次运算。 3 5 X 5 6 ————————————————————————— 2 1 0
2020-05-17 14:47:54
824
原创 PAT A1096
1096 Consecutive Factors (20 分)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, and 7 are the three...
2019-02-23 20:21:49
105
原创 PAT A1048
1048 Find Coins (25 分)Eva loves to collect coins from all over the universe, including some other planets like Mars. One day she visited a universal shopping mall which could accept all kinds of coin...
2019-02-18 00:41:31
129
原创 PAT A1051(栈)
1051 Pop Sequence (25 分)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 supposed to tell if a given sequence of numbers is a pos...
2019-02-14 14:35:30
172
原创 PAT A1041
1041 Be Unique (20 分)Being unique is so important to people on Mars that even their lottery is designed in a unique way. The rule of winning is simple: one bets on a number chosen from [1,104]. Th...
2019-02-12 12:13:57
190
2
原创 树的最大深度问题
树的最大深度问题树的最大深度求解方法利用的遍历递归的同时给深度加一,这里的遍历只是遍历到叶子节点的位置。/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(in...
2018-09-05 23:24:40
238
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人