码迷,mamicode.com
首页 >  
搜索关键字:solution    ( 11547个结果
03_02_leetcode_11_盛最多的水
1.题目描述 给你 n 个非负整数 a1,a2,...,an,每个数代表坐标中的一个点 (i, ai) 。在坐标内画 n 条垂直线,垂直线 i 的两个端点分别为 (i, ai) 和 (i, 0) 。找出其中的两条线,使得它们与 x 轴共同构成的容器可以容纳最多的水。 说明:你不能倾斜容器 示例 1: ...
分类:其他好文   时间:2021-03-29 12:37:26    阅读次数:0
*剑指 Offer 56 - I. 数组中数字出现的次数
新的一天开始刷题。 这道题完全没有思路,忘记了异或操作。 思路注释里写的很清晰了,注意&与&&的差别以及最后返回的写法。 剑指 Offer 56 - I. 数组中数字出现的次数 class Solution { public int[] singleNumbers(int[] nums) { int ...
分类:编程语言   时间:2021-03-26 15:24:12    阅读次数:0
剑指 Offer 29. 顺时针打印矩阵
这个题蛮有意思的。学习了大佬的思路。 注意边界情况,当输入空数组时,返回了一个匿名数组的写法。 以及保证数组不越界,及时退出循环的思路。 我原来写的while循环条件是(cnt<num),且没有写退出循环的四个判断,是有问题的。 class Solution { public int[] spira ...
分类:其他好文   时间:2021-03-18 14:39:28    阅读次数:0
[LeetCode] 670. Maximum Swap
Given a non-negative integer, you could swap two digits at most once to get the maximum valued number. Return the maximum valued number you could get. ...
分类:其他好文   时间:2021-03-18 14:32:17    阅读次数:0
MSBUILD : error MSB3428: 未能加载 Visual C++ 组件“VCBuild.exe”。
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.Build started 2021/3/17 0:22:07.Project "D: ...
分类:编程语言   时间:2021-03-17 15:05:07    阅读次数:0
LeetCode_139_单词拆分
class Solution { public boolean wordBreak(String s, List<String> wordDict) { return isContain(s, wordDict); } Map<String,Boolean> map = new HashMap<>( ...
分类:其他好文   时间:2021-03-17 14:50:42    阅读次数:0
LeetCode_424_替换后的最长字符串
class Solution { public int characterReplacement(String s, int k) { int left =0,right=0; int maxLength = -1; int result = 0; char[] charNums = new cha ...
分类:其他好文   时间:2021-03-17 14:50:06    阅读次数:0
57. 插入区间 - LeetCode
57. 插入区间 题目链接 枚举 枚举每个区间,判断该区间与需要插入的区间是否相交 若不相交,且比需要插入的区间小,那么直接放入List中 若不相交,但比需要插入的区间大,那么先把区间插入,再把这个区间放入List 若相交,则把这个区间和需要插入的区间合并,继续枚举 class Solution { ...
分类:其他好文   时间:2021-03-17 14:30:31    阅读次数:0
剑指 Offer 58 - II. 左旋转字符串
仅供自己学习 思路: 可以直接把0~n-1的位置的元素加入到s后面,然后再把0~n-1的元素删除即可。分别调用append,erase函数 代码: 1 class Solution { 2 public: 3 string reverseLeftWords(string s, int n) { 4 ...
分类:其他好文   时间:2021-03-16 14:08:17    阅读次数:0
剑指 Offer 19. 正则表达式匹配
这题好难。自己没想到用动态规划,敲了很久,敲出了可以通过400个测试点的代码,还是有一些情况没有考虑到。不舍得删,记录一下。对输入用例 "aaa" "abac*a" 不能给出正确答案。 class Solution { public boolean isMatch(String s, String ...
分类:其他好文   时间:2021-03-16 13:45:02    阅读次数:0
11547条   上一页 1 ... 16 17 18 19 20 ... 1155 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!