上一页 1 2 3 4 5 6 7 8 ··· 10 下一页
2021年8月30日
摘要: 【题目】 将两个有序链表合并成一个有序链表 Merge two sorted linked lists and return it as a sorted list. The list should be made by splicing together the nodes of the firs 阅读全文
posted @ 2021-08-30 20:40 alau 阅读(21) 评论(0) 推荐(0) 编辑
2021年8月23日
摘要: 【题目】 木桶短板,能装的最多水,由最短的那条决定 Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). n vertical lines are dr 阅读全文
posted @ 2021-08-23 23:23 alau 阅读(38) 评论(0) 推荐(0) 编辑
摘要: 【整体思路】 先Arrays.sort()排序,不然后续指针没法用 对于K数之和,固定K-2个指针(循环),再用两指针一头一尾,根据sum大了小了,调左或调右 4数之和,2固定2移动; 3数之和,1固定2移动; 一定要记得去重,不仅为了减少工作量,也是确保输出结果的唯一 【题目】 leetcode1 阅读全文
posted @ 2021-08-23 22:39 alau 阅读(71) 评论(0) 推荐(0) 编辑
摘要: 【题目】 问每只兔子,有多少只和你颜色相同的(颜色问全了,不一定问道每只兔子),求这片森林中至少有多少只兔子 There is a forest with an unknown number of rabbits. We asked n rabbits "How many rabbits have 阅读全文
posted @ 2021-08-23 19:09 alau 阅读(43) 评论(0) 推荐(0) 编辑
摘要: 【总结】 参考https://www.bilibili.com/video/BV1Pv4y1Z76N 适用情况:大部分需数组升序 【代码】 27 移除元素 不用管移除后半部分是否为正确答案,所以可直接nums[flag]=nums[i] class Solution { public int rem 阅读全文
posted @ 2021-08-23 16:52 alau 阅读(33) 评论(0) 推荐(0) 编辑
摘要: 【题目】 合并两个数组,两个数组已分别顺序排好,不能使用额外数组,就存在nums1中 You are given two integer arrays nums1 and nums2, sorted in non-decreasing order, and two integers m and n, 阅读全文
posted @ 2021-08-23 11:23 alau 阅读(47) 评论(0) 推荐(0) 编辑
2021年8月22日
摘要: 【题目】 找到第一个没有重复出现的字母 Given a string s, find the first non-repeating character in it and return its index. If it does not exist, return -1. Example 1: I 阅读全文
posted @ 2021-08-22 22:44 alau 阅读(26) 评论(0) 推荐(0) 编辑
摘要: 待整理,N数之和,数组中选数列/数字达到特定值,硬币特定值 硬币;https://www.bilibili.com/video/BV1cT4y1w7Ct 阅读全文
posted @ 2021-08-22 15:10 alau 阅读(20) 评论(0) 推荐(0) 编辑
摘要: 【题目1】 此系列有三题,都是强盗偷家不能偷相邻邻居,否则会被发现。问最多能偷多少钱 You are a professional robber planning to rob houses along a street. Each house has a certain amount of mon 阅读全文
posted @ 2021-08-22 13:10 alau 阅读(64) 评论(0) 推荐(0) 编辑
摘要: 【题目】 爬楼梯变式,可以上1/2台阶,每个台阶有cost,求爬上去的最小耗费 You are given an integer array cost where cost[i] is the cost of ith step on a staircase. Once you pay the cos 阅读全文
posted @ 2021-08-22 11:30 alau 阅读(51) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 10 下一页