0%

Description

Given an array of non-negative integers, you are initially positioned at the first index of the array.

Each element in the array represents your maximum jump length at that position.

Determine if you are able to reach the last index.

Example 1:

1
2
3
Input: [2,3,1,1,4]
Output: true
Explanation: Jump 1 step from index 0 to 1, then 3 steps to the last index.

Example 2:

1
2
3
4
Input: [3,2,1,0,4]
Output: false
Explanation: You will always arrive at index 3 no matter what. Its maximum
jump length is 0, which makes it impossible to reach the last index.

Difficulty: Medium

Code:

1
2
3
4
5
class Solution {
public boolean canJump(int[] nums) {

}
}

题意

有一个非负数组,每个数字表示在当前位置最大能跳跃的跨度,初始位置在第一个位置,求是否能达到最后一个位置。

阅读全文 »

访问图片出现403的解决办法

有时候在页面里用img标签访问页面图片返回403 forbidden,而浏览器可以直接打开。

是因为图片服务器加了防盗链,会检测访问图片的referer。

总结了一下,有两种方法是可以解决这个问题的:

  • 使用images.weserv.nl方案
  • 使用no-referrer方案
阅读全文 »

目录

主板
  Intel芯片组主板
  AMD芯片组主板
  主板尺寸
  关于品牌
CPU
  关键参数
  Intel CPU后面的数字
  Intel CPU后面的字母
  AMD CPU后面的数字
  CPU天梯图
  CPU的主要厂商
显卡
  显卡品牌:N卡和A卡
  关于品牌
  核心显卡、主板集成显卡和独立显卡的区别
内存条
  单通道与双通道
硬盘
  机械硬盘
  固态硬盘
电源
  功率的选择
  80Plus认证
  模组选择
  电源尺寸
  关于品牌
散热器
  散热器的工作原理
  影响散热效果的因素(风冷)
  热量传递的效率
  风冷散热器的类型
  关于品牌
显示器
  显示器接口
  液晶面板
  带鱼屏
机箱
搭配选择
如果因为资金原因,那么哪些电脑配件可以选择二手的,哪些不能呢?
参考
  硬件知识
  组装电脑


电脑主要配件:主板、CPU、显卡、显示器、电源、机箱、内存条、硬盘。CPU、显卡、内存条、硬盘是插在主板上的,电源用来给主板上的部件进行供电,CPU,主板,显卡,内存条、硬盘、电源这几个放在机箱中就构成了我们通常所说的主机。摩尔定律,硬件的性能每隔18~20个月就会提升一倍。

阅读全文 »

Description

Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.

Example 1:

1
2
3
4
5
6
7
Input:
[
[ 1, 2, 3 ],
[ 4, 5, 6 ],
[ 7, 8, 9 ]
]
Output: [1,2,3,6,9,8,7,4,5]

Example 2:

1
2
3
4
5
6
7
Input:
[
[1, 2, 3, 4],
[5, 6, 7, 8],
[9,10,11,12]
]
Output: [1,2,3,4,8,12,11,10,9,5,6,7]

Difficulty: Medium

Code:

1
2
3
4
5
class Solution {
public List<Integer> spiralOrder(int[][] matrix) {

}
}

题意

给定m x n的矩阵,按照螺旋的顺序返回所有元素。

阅读全文 »

Description

Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.

Example:

1
2
3
Input: [-2,1,-3,4,-1,2,1,-5,4],
Output: 6
Explanation: [4,-1,2,1] has the largest sum = 6.

Follow Up:

1
If you have figured out the O(n) solution, try coding another solution using the divide and conquer approach, which is more subtle.

Difficulty: Easy

Code:

1
2
3
4
5
class Solution {
public int maxSubArray(int[] nums) {

}
}

题意

给定一个数字数组,找出一个连续都子数组,其所有数之和最大,并返回这个和。

如果已经找到来复杂度为O(n)的解法,可以试试分治的思路。

阅读全文 »