自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(28)
  • 收藏
  • 关注

转载 isset()和empty()区别

if(!empty($_FILES["img"]["name"]))if(!isset$_POST["name"])//empty()可以判断设置了但是为空的数据,比如$_FILE文件里面的name属性,一定是有的,但是如果没有上传文件则为空// 1、若变量不存在则返回 TRUE// 2、若变量存在且其值为""、0、"0"、NULL、、FALSE、array()、var $var...

2019-08-16 18:44:00 125

转载 图像渲染

题目有一幅以二维整数数组表示的图画,每一个整数表示该图画的像素值大小,数值在 0 到 65535 之间。给你一个坐标 (sr, sc) 表示图像渲染开始的像素值(行 ,列)和一个新的颜色值 newColor,让你重新上色这幅图像。为了完成上色工作,从初始坐标开始,记录初始坐标的上下左右四个方向上像素值与初始坐标相同的相连像素点,接着再记录这四个方向上符合条件的像素点与他们对应四个方...

2018-12-26 22:16:00 135

转载 Leetcode 328. 奇偶链表

题目给定一个单链表,把所有的奇数节点和偶数节点分别排在一起。请注意,这里的奇数节点和偶数节点指的是节点编号的奇偶性,而不是节点的值的奇偶性。请尝试使用原地算法完成。你的算法的空间复杂度应为 O(1),时间复杂度应为 O(nodes),nodes 为节点总数。示例 1:输入: 1->2->3->4->5->NULL输出: 1->3->5-...

2018-12-25 15:46:00 89

转载 LeetCode 16. 最接近的三数之和

题目给定一个包括 n 个整数的数组 nums 和 一个目标值 target。找出 nums 中的三个整数,使得它们的和与 target 最接近。返回这三个数的和。假定每组输入只存在唯一答案。例如,给定数组 nums = [-1,2,1,-4], 和 target = 1.与 target 最接近的三个数的和为 2. (-1 + 2 + 1 = 2).思路利用双指针,将数组进行排...

2018-12-25 15:19:00 70

转载 用队列实现栈

题目使用队列实现栈的下列操作:push(x) -- 元素 x 入栈pop() -- 移除栈顶元素top() -- 获取栈顶元素empty() -- 返回栈是否为空注意:你只能使用队列的基本操作-- 也就是 push to back, peek/pop from front, size, 和 is empty 这些操作是合法的。你所使用的语言也许不支持队列。 你可以使用 l...

2018-12-25 14:02:00 81

转载 用栈实现队列

题目使用栈实现队列的下列操作:push(x) -- 将一个元素放入队列的尾部。pop() -- 从队列首部移除元素。peek() -- 返回队列首部的元素。empty() -- 返回队列是否为空。示例:MyQueue queue = new MyQueue();queue.push(1);queue.push(2);queue.peek(); // 返回 1queu...

2018-12-25 13:59:00 75

转载 下一个更大元素 I(LeetCode 496)

题目给定两个没有重复元素的数组 nums1 和 nums2 ,其中nums1 是 nums2 的子集。找到 nums1 中每个元素在 nums2 中的下一个比其大的值。nums1 中数字 x 的下一个更大元素是指 x 在 nums2 中对应位置的右边的第一个比 x 大的元素。如果不存在,对应位置输出-1。示例 1:输入: nums1 = [4,1,2], nums2 = [1,3...

2018-12-25 13:36:00 168

转载 逆波兰表达式求值

题目根据逆波兰表示法,求表达式的值。有效的运算符包括 +, -, *, / 。每个运算对象可以是整数,也可以是另一个逆波兰表达式。说明:整数除法只保留整数部分。给定逆波兰表达式总是有效的。换句话说,表达式总会得出有效数值且不存在除数为 0 的情况。示例 1:输入: ["2", "1", "+", "3", "*"]输出: 9解释: ((2 + 1) * 3) = 9示...

2018-12-25 13:12:00 138

转载 有效的括号

题目给定一个只包括 '(',')','{','}','[',']' 的字符串,判断字符串是否有效。有效字符串需满足:左括号必须用相同类型的右括号闭合。左括号必须以正确的顺序闭合。注意空字符串可被认为是有效字符串。示例 1:输入: "()"输出: true示例 2:输入: "()[]{}"输出: true思路用栈,遇到左括号就入栈,遇到右括号就判断栈顶的左括号与当...

2018-12-25 12:59:00 76

转载 每日温度

题意根据每日 气温 列表,请重新生成一个列表,对应位置的输入是你需要再等待多久温度才会升高的天数。如果之后都不会升高,请输入 0 来代替。例如,给定一个列表 temperatures = [73, 74, 75, 71, 69, 72, 76, 73],你的输出应该是 [1, 1, 4, 2, 1, 1, 0, 0]。提示:气温 列表长度的范围是 [1, 30000]。每个气温的值...

2018-12-25 12:42:00 112

转载 路径总和

Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.Note:A leaf is a node with no childr...

2018-11-21 19:27:00 88

转载 对称二叉树

Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree[1,2,2,3,4,4,3]is symmetric: 1 / \ 2 2 / \ /...

2018-11-21 19:21:00 70

转载 二叉树的最大深度

Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.Note:A leaf is a node wi...

2018-11-21 19:13:00 74

转载 二叉树的层次遍历

Given a binary tree, return thelevel ordertraversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree[3,9,20,null,null,15,7], 3 / ...

2018-11-21 18:58:00 97

转载 两个数组的交集 II

Given two arrays, write a function to compute their intersection.Example 1:Input: nums1 = [1,2,2,1], nums2 = [2,2]Output: [2,2]Example 2:Input: nums1 = [4,9,5], nums2 = [9,4...

2018-11-21 13:39:00 87

转载 字符串中的第一个唯一字符

Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1.Examples:s = "leetcode"return 0.s = "loveleetcode",return 2....

2018-11-21 13:33:00 72

转载 两个列表的最小索引总和

Suppose Andy and Doris want to choose a restaurant for dinner, and they both have a list of favorite restaurants represented by strings.You need to help them find out theircommon inter...

2018-11-21 13:28:00 136

转载 两数之和

Given an array of integers, returnindicesof the two numbers such that they add up to a specific target.You may assume that each input would haveexactlyone solution, and you may not use the...

2018-11-21 13:16:00 78

转载 两个数组的交集

Given two arrays, write a function to compute their intersection.Example 1:Input: nums1 = [1,2,2,1], nums2 = [2,2]Output: [2]Example 2:Input: nums1 = [4,9,5], nums2 = [9,4,9...

2018-11-21 12:07:00 95

转载 只出现一次的数字

Given anon-emptyarray of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement ...

2018-11-21 12:00:00 46

转载 存在重复元素

Given an array of integers, find if the array contains any duplicates.Your function should return true if any value appears at least twice in the array, and it should return false if ev...

2018-11-21 11:51:00 85

转载 杨辉三角

Given a non-negative integernumRows, generate the firstnumRowsof Pascal's triangle.In Pascal's triangle, each number is the sum of the two numbers directly above it.Example:Input: 5...

2018-11-21 09:21:00 86

转载 删除链表的倒数第n个结点

Given a linked list, remove then-th node from the end of list and return its head.Example:Given linked list: 1->2->3->4->5, and n = 2.After removing the second node f...

2018-11-20 14:43:00 59

转载 相交链表

Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: a1 → a2 ↘...

2018-11-20 12:29:00 58

转载 环形链表 II

Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Note:Do not modify the linked list.Follow up:Can you solve it without using extra space...

2018-11-20 12:16:00 48

转载 环形链表

Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?题意:判断一个链表是否有环思路:快慢指针,如果会相遇,则说明有环,如果快指针到了链表的末尾没有相遇,则说明没有环/** * D...

2018-11-20 12:01:00 52

转载 至少是其他数字两倍的最大数

In a given integer arraynums, there is always exactly one largest element.Find whether the largest element in the array is at least twice as much as every other number in the array....

2018-11-20 11:48:00 128

转载 寻找数组的中心索引

Given an array of integersnums, write a method that returns the "pivot" index of this array.We define the pivot index as the index where the sum of the numbers to the left of the ind...

2018-11-20 11:39:00 58

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除