##题面 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
可以想到,数组中会出现“断层”,直接遍历一次即可。不存在【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
原作者:CodingCode 原链接:https://www.jianshu.com/p/ff1877c5864e git merge的三种操作merge, squash merge, 和rebase merge 举例来说: 假设在master分支的B点拉出一个新的分支dev,经过一段时间开发后: ...
分类:
其他好文 时间:
2020-07-21 22:33:40
阅读次数:
71
在转换的字符串中,存在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
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
题目要求 算法分析 可以用双指针法, 分别指向头尾元素,如果两元素的和大于目标,尾指针前移,如果小于目标,头指针后移,等于目标即可得答案 代码展示(C#) public class Solution { public int[] TwoSum(int[] numbers, int target) { ...
分类:
编程语言 时间:
2020-07-20 10:40:01
阅读次数:
55
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
#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
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
problem 1380. Lucky Numbers in a Matrix 在矩阵中,如果一个数既是它所在行的最小值,又是它所在列的最大值,则称这个数为幸运数。找到矩阵中所有的幸运数。 Constraints All elements in the matrix are distinct. so ...
分类:
其他好文 时间:
2020-07-16 00:15:33
阅读次数:
72