
LeetCode
LeetCode每日一题
KKKKKKOBE_24
这个作者很懒,什么都没留下…
展开
-
[LeetCode]36. Valid Sudoku
36. Valid Sudoku一、题目Problem Description:Determine if a 9∗99 * 99∗9 Sudoku board is valid. Only the filled cells need to be validated according to the following.Rules:Each row must contain the digits 1−91-91−9 without repetition.Each column must cont原创 2020-12-03 14:23:26 · 143 阅读 · 0 评论 -
[LeetCode]48. Rotate Image
48. Rotate Image一、题目Problem Description:You are given an nxnn x nnxn 2D matrix representing an image, rotate the image by 90 degrees (clockwise).You have to rotate the image in-place, which means you have to modify the input 2D matrix directly. DO NOT原创 2020-12-02 21:02:12 · 207 阅读 · 0 评论 -
[LeetCode]189. Rotate Array
189. Rotate Array一、题目Problem Description:Given an array, rotate the array to the right by k steps, where k is non-negative.Follow up:Try to come up as many solutions as you can, there are at least 3 different ways to solve this problem.Could you do i原创 2020-12-01 20:31:11 · 123 阅读 · 0 评论 -
[LeetCode]217. Contains Duplicate
217. Contains Duplicate一、题目Problem Description: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 every element is disti原创 2020-11-29 21:06:11 · 155 阅读 · 0 评论 -
[LeetCode]136. Single Number
136. Single Number一、题目Problem Description:Given a non-empty array of integers nums, every element appears twice except for one. Find that single one.Follow up:Could you implement a solution with a linear runtime complexity and without using extra memo原创 2020-11-29 18:12:32 · 173 阅读 · 0 评论 -
[LeetCode]66. Plus One
66. Plus One一、题目Problem Description:Given a non-empty array of decimal digits representing a non-negative integer, increment one to the integer.The digits are stored such that the most significant digit is at the head of the list, and each element in t原创 2020-11-28 22:12:38 · 200 阅读 · 0 评论 -
[LeetCode]1. Two Sum
1. Two Sum一、题目Problem Description:Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.You may assume that each input would have exactly one solution, and you may not use the same elem原创 2020-11-28 19:44:14 · 355 阅读 · 2 评论 -
[LeetCode]122. Best Time to Buy and Sell Stock II
122. Best Time to Buy and Sell Stock II一、题目Problem Description:Say you have an array prices for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you li原创 2020-11-27 14:48:18 · 202 阅读 · 0 评论 -
[LeetCode]26. Remove Duplicates from Sorted Array、80. ... II、27. Remove Element、283. Move Zeroes
26题删除数组中的重复元素80题删除数组中的重复元素,使得数组中值相同的元素最多出现两次27题删除数组中的指定元素283题删除数组中的0这几道题相对简单,实质是一样的,采用 Two Pointers 可实现多题一解,归纳为一个系列的题。题目这里就不在描述,可点击下面的题目链接查看原题26. Remove Duplicates from Sorted ArrayTwo Pointers:一个指针跟踪原始数组中的当前元素,另一个指针跟踪唯一元素Time complexity : O(n)O(n)原创 2020-11-27 13:13:28 · 133 阅读 · 0 评论 -
[LeetCode]198. House Robber
198. House Robber一、题目Problem Description:You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have secur原创 2020-11-26 14:32:08 · 191 阅读 · 0 评论 -
[LeetCode]121. Best Time to Buy and Sell Stock
121. Best Time to Buy and Sell Stock一、题目Problem Description:Say you have an array for which the ithi^{th}ith element is the price of a given stock on day iii.If you were only permitted to complete at most one transaction (i.e., buy one and sell one sha原创 2020-11-25 21:54:23 · 166 阅读 · 0 评论 -
[LeetCode]70. Climbing Stairs
70. Climbing Stairs一、题目Problem Description:You are climbing a staircase. It takes n steps to reach the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?Example 1:Input: n = 2Output: 2Explanation: T原创 2020-11-24 22:37:02 · 266 阅读 · 0 评论 -
[LeetCode/PriorityQueue/Java]LeetCode之Heap(PriorityQueue)题解(Java)
PriorityQueue(优先队列)基础知识和常用方法: [PriorityQueue/Java]PriorityQueue(优先队列)215. Kth Largest Element in an Array一、题目Problem Description:Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth原创 2020-10-24 23:33:59 · 354 阅读 · 0 评论 -
[LeetCode/笔试]605. Can Place Flowers + 2020vivo提前批笔试第一题
[LeetCode]605. Can Place Flowers一、vivo真题二、Leetcode题目三、解题思路3.1 直接解法3.2 优化解法上周末,实验室师兄参加Vivo的提前批笔试。一共三道题,都是LeetCode的原题,只是vivo在题干中添加了自己公司大段文案,加上了一个外包装,看上去题目非常的长,实际上没有增加题目难度,和原题一模一样。根据vivo提前批笔试题目顺序,依次带来这三道LeetCode题目。一、vivo真题以上图片就是vivo第一题,来自LeetCode 605. Ca原创 2020-06-12 14:10:31 · 379 阅读 · 0 评论 -
[LeetCode]53. Maximum Subarray(暴力穷举+Dynamic Programming+Kadane)
[LeetCode]53. Maximum Subarray(暴力破解+Dynamic Programming+Kadane)一、问题描述二、暴力破解三、Dynamic Programming3.1 Dynamic Programming关键步骤3.1.1 定义子问题3.1.2 设置边界和初始条件/递推基3.1.3 方程/递推关系3.2 代码四、Kadane4.1 算法描述4.2 代码新的改变功能快捷键合理的创建标题,有助于目录的生成如何改变文本的样式插入链接与图片如何插入一段漂亮的代码片生成一个适合你的列原创 2020-05-17 15:57:34 · 537 阅读 · 2 评论