码迷,mamicode.com
首页 >  
搜索关键字:consecutive numbers    ( 8082个结果
HDU 1848 Fibonacci again and again (sg函数,博弈论)
##题面 Problem Description 任何一个大学生对菲波那契数列(Fibonacci numbers)应该都不会陌生,它是这样定义的: F(1)=1; F(2)=2; F(n)=F(n-1)+F(n-2)(n>=3); 所以,1,2,3,5,8,13……就是菲波那契数列。 在HDOJ上 ...
分类:其他好文   时间:2020-07-22 15:43:22    阅读次数:61
剑指 Offer 11. 旋转数组的最小数字 Java
可以想到,数组中会出现“断层”,直接遍历一次即可。不存在【1,2,3,4,5】旋转成【5,4,3,2,1】的情况。 暴力法(我感觉还行啊,为什么被叫暴力): class Solution { public int minArray(int[] numbers) { int n = numbers.l ...
分类:编程语言   时间:2020-07-22 11:13:53    阅读次数:50
git merge的三种操作merge, squash merge, 和rebase merge
原作者:CodingCode 原链接:https://www.jianshu.com/p/ff1877c5864e git merge的三种操作merge, squash merge, 和rebase merge 举例来说: 假设在master分支的B点拉出一个新的分支dev,经过一段时间开发后: ...
分类:其他好文   时间:2020-07-21 22:33:40    阅读次数:71
eval报错NameError: name 'null' is not defined
在转换的字符串中,存在null时,就会出现NameError: name ‘null’ is not defined这个错误。 解决办法:使用replace方法将null替换掉 注意:replace argument 2 must be str replace的两个参数都必须为字符串 str.rep ...
分类:其他好文   时间:2020-07-21 13:58:35    阅读次数:67
167两数之和II-输入有序数组
from typing import List# 这道题很容易能够想到,只需要遍历两边列表就可以了# 两层循环class Solution: def twoSum(self, numbers: List[int], target: int) -> List[int]: # 第一次遍历列表 for i ...
分类:编程语言   时间:2020-07-21 01:14:53    阅读次数:97
LeetCode0167.两数之和 II - 输入有序数组
题目要求 算法分析 可以用双指针法, 分别指向头尾元素,如果两元素的和大于目标,尾指针前移,如果小于目标,头指针后移,等于目标即可得答案 代码展示(C#) public class Solution { public int[] TwoSum(int[] numbers, int target) { ...
分类:编程语言   时间:2020-07-20 10:40:01    阅读次数:55
1060. Missing Element in Sorted Array
package LeetCode_1060 /** * 1060. Missing Element in Sorted Array * (Prime) * Given a sorted array A of unique numbers, find the K-th missing number s ...
分类:其他好文   时间:2020-07-19 00:49:27    阅读次数:93
1019 数字黑洞 (20分)/1069 The Black Hole of Numbers (20分)
#include<iostream> #include<algorithm> #include<cstdio> using namespace std; bool cmp(int a,int b){ return a>b; } void to_array(int n,int num []) { fo ...
分类:其他好文   时间:2020-07-18 11:39:12    阅读次数:78
leetcode148two-sum
Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two n ...
分类:其他好文   时间:2020-07-17 13:33:50    阅读次数:46
【leetcode_easy_array】1380. Lucky Numbers in a Matrix
problem 1380. Lucky Numbers in a Matrix 在矩阵中,如果一个数既是它所在行的最小值,又是它所在列的最大值,则称这个数为幸运数。找到矩阵中所有的幸运数。 Constraints All elements in the matrix are distinct. so ...
分类:其他好文   时间:2020-07-16 00:15:33    阅读次数:72
8082条   上一页 1 ... 9 10 11 12 13 ... 809 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!