摘要: 203.移除链表元素 方法一:直接遍历,永远记得处理head, 删除链表必须有前驱。 /** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode() 阅读全文
posted @ 2024-08-16 17:32 爱刷题的小盒子 阅读(326) 评论(0) 推荐(0)
摘要: 209.长度最小的子数组 class Solution { public int minSubArrayLen(int target, int[] nums) { int left = 0; int sum = 0; //int result = Integer.MAX_VALUE;无法编译,改成长 阅读全文
posted @ 2024-08-16 15:30 爱刷题的小盒子 阅读(301) 评论(0) 推荐(0)
摘要: 704. 二分查找 题目链接:https://leetcode.cn/problems/binary-search/ 1,左闭右闭 class Solution { public int search(int[] nums, int target) { //左闭右闭就是left <= right, 阅读全文
posted @ 2024-08-15 17:28 爱刷题的小盒子 阅读(305) 评论(0) 推荐(0)
摘要: Given amxnmatrix, if an element is 0, set its entire row and column to 0. Do it in place.Follow up:Did you use extra space?A straight forward solution... 阅读全文
posted @ 2016-01-12 06:18 爱刷题的小盒子 阅读(221) 评论(0) 推荐(0)
摘要: Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space i... 阅读全文
posted @ 2015-05-30 04:12 爱刷题的小盒子 阅读(1385) 评论(0) 推荐(0)
摘要: 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 yo... 阅读全文
posted @ 2015-05-30 01:39 爱刷题的小盒子 阅读(164) 评论(0) 推荐(0)
摘要: Minimum Path SumGiven amxngrid filled with non-negative numbers, find a path from top left to bottom right whichminimizesthe sum of all numbers along ... 阅读全文
posted @ 2015-05-30 01:26 爱刷题的小盒子 阅读(121) 评论(0) 推荐(0)
摘要: 123Best Time to Buy and Sell Stock IIISay you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find ... 阅读全文
posted @ 2015-05-28 13:46 爱刷题的小盒子 阅读(612) 评论(0) 推荐(0)
摘要: leetCode 122 Best Time to Buy and Sell Stock IISay you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm... 阅读全文
posted @ 2015-05-27 10:42 爱刷题的小盒子 阅读(138) 评论(0) 推荐(0)
摘要: leetCode 121 Best Time to Buy and Sell StockSay you have an array for which theithelement is the price of a given stock on dayi.If you were only permi... 阅读全文
posted @ 2015-05-27 09:30 爱刷题的小盒子 阅读(184) 评论(0) 推荐(0)