题目 让函数PermulationStep(num)接受传递的num参数,并使用相同的数字返回大于num的下一个数字 例如:如果num为123,则返回132; 如果为12345,则返回12354. 如果一个数字没有更大的排列,则返回 1(即999) 例子 输入:11121 输出:11211 输入:4 ...
分类:
其他好文 时间:
2020-05-03 14:38:28
阅读次数:
59
题目 有一个序列:1/2, 2/3, 3/5, 5/8, 8/13...,写一段Python代码,求出这个序列前10项的和 分析 可以分别用变量表示分母和分子,在根据规则计算出下一个分数时,要同时改变分母和分子的值 代码实现 ...
分类:
其他好文 时间:
2020-05-03 14:32:06
阅读次数:
55
一、题目说明 题目739. Daily Temperatures,返回一列数,改天要等多少天才能升温。难度是Medium! 二、我的解答 这个题目,用dp解决非常方便: 性能如下: ...
分类:
其他好文 时间:
2020-05-03 12:17:03
阅读次数:
48
我的LeetCode:https://leetcode cn.com/u/ituring/ 我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/Algorithmcii LeetCode 面试题15. 二进制中1的个数 与以下题目相同 前往:Leet ...
分类:
其他好文 时间:
2020-05-02 23:12:09
阅读次数:
76
我的LeetCode:https://leetcode cn.com/u/ituring/ 我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/Algorithmcii LeetCode 191. 位1的个数 题目 编写一个函数,输入是一个无符号整数 ...
分类:
其他好文 时间:
2020-05-02 23:08:11
阅读次数:
50
题目 232.用栈实现队列 class MyQueue { private Stack<Integer> in = new Stack<>(); private Stack<Integer> out = new Stack<>(); public void push(int x) { in.push ...
分类:
其他好文 时间:
2020-05-02 22:35:31
阅读次数:
86
我的LeetCode:https://leetcode cn.com/u/ituring/ 我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/Algorithmcii LeetCode 面试题05. 替换空格 题目 请实现一个函数,把字符串 s 中 ...
分类:
其他好文 时间:
2020-05-02 20:41:43
阅读次数:
54
我的LeetCode:https://leetcode cn.com/u/ituring/ 我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/Algorithmcii LeetCode 面试题06. 从尾到头打印链表 题目 输入一个链表的头节点,从 ...
分类:
其他好文 时间:
2020-05-02 20:41:15
阅读次数:
63
我的LeetCode:https://leetcode cn.com/u/ituring/ 我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/Algorithmcii LeetCode 面试题03. 数组中重复的数字 题目 找出数组中重复的数字。 ...
分类:
编程语言 时间:
2020-05-02 20:33:36
阅读次数:
59
在一个二维数组中(每个一维数组的长度相同),每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序。请完成一个函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数。 这道题要注意对二维数组为空的判断,不能用if(array==null)因为有[[]],应该用数组长度判断: ...
分类:
编程语言 时间:
2020-05-02 19:08:24
阅读次数:
53