Loading

11 2020 档案

摘要:题目:https://leetcode-cn.com/problems/reorganize-string/submissions/ 题解:要使相邻的字符不重复,那么存在一种情况:当一个字符出现次数大于总字符数一半时,那么一定存在相同字符相邻。为了不使相同字符相邻,那么每个字符都应该与自己上一个字符 阅读全文
posted @ 2020-11-30 18:02 yoyuLiu 阅读(140) 评论(0) 推荐(0)
摘要:题目:https://leetcode-cn.com/problems/ju-zhen-zhong-de-lu-jing-lcof/submissions/ 代码: class Solution { public boolean exist(char[][] board, String word) 阅读全文
posted @ 2020-11-29 14:57 yoyuLiu 阅读(58) 评论(0) 推荐(0)
摘要:题目:https://leetcode-cn.com/problems/shu-zu-zhong-shu-zi-chu-xian-de-ci-shu-lcof/submissions/ 代码: class Solution { public int[] singleNumbers(int[] num 阅读全文
posted @ 2020-11-28 12:00 yoyuLiu 阅读(87) 评论(0) 推荐(0)
摘要:题目:https://leetcode-cn.com/problems/4sum-ii/ 代码: class Solution { public int fourSumCount(int[] A, int[] B, int[] C, int[] D) { HashMap<Integer, Integ 阅读全文
posted @ 2020-11-27 10:41 yoyuLiu 阅读(56) 评论(0) 推荐(0)
摘要:题目:https://leetcode-cn.com/problems/dui-lie-de-zui-da-zhi-lcof/ 题意:实现一个队列接口,使它能够在o(1)时间内获取队列中的最大值 思路:双端队列。因为队列存在入队和出队的操作,所以队列中的最大值不是固定的。队列含有先进先出的特性,所以 阅读全文
posted @ 2020-11-26 12:13 yoyuLiu 阅读(123) 评论(0) 推荐(0)
摘要:题目:https://leetcode-cn.com/problems/xiao-zhang-shua-ti-ji-hua/ 题意:将一个数组分为m份,其中最大个数的那一份元素之和t要最小。 官方题解:如果不考虑每份可以任意减去一个元素,就是一个经典的二分问题,具有单调最优的性质:如果最大值为 t可 阅读全文
posted @ 2020-11-22 11:24 yoyuLiu 阅读(255) 评论(0) 推荐(0)