码迷,mamicode.com
首页 >  
搜索关键字:leetcode 19    ( 34993个结果
Leetcode 234. Palindrome Linked List
Description: Given a singly linked list, determine if it is a palindrome. Link: https://leetcode.com/problems/palindrome-linked-list/ Examples: Exampl ...
分类:其他好文   时间:2020-12-05 11:02:42    阅读次数:7
771. Jewels and Stones
package LeetCode_771 /** * 771. Jewels and Stones * https://leetcode.com/problems/jewels-and-stones/ * You're given strings J representing the types o ...
分类:其他好文   时间:2020-12-05 10:48:43    阅读次数:7
[LeetCode]1674. 使数组互补的最少操作次数(扫描 + 差分\树状数组)
1674. 使数组互补的最少操作次数 ? LeetCode第217周赛的第三题,比赛时卡了一个小时,没有想到O(n)的做法。对差分不熟悉,但是最关键的还是扫描的思路没有想到。由于这道题有这么几个点比较重要,觉得应该特别记录一下。 扫描:比赛时我也想到了当选定和K处于个个区间[2, lo]、[lo, ...
分类:编程语言   时间:2020-12-04 11:33:41    阅读次数:9
LeetCode刷题-04-排序
第四讲 排序 4.1 巨经典的排序算法 1. 冒泡排序(很简单) 平均时间复杂度 O(n^2) ,空间复杂度 O(1),稳定 基本思想 两个数比较大小,较大的数下沉,较小的数冒起来。 演示(图片来自菜鸟教程) 代码 /** * 冒泡排序 * @param array 待排序的数组 */ public ...
分类:编程语言   时间:2020-12-04 11:29:30    阅读次数:5
LeetCode #1389. Create Target Array in the Given Order
###题目 1389. Create Target Array in the Given Order ###解题方法 创建一个新数组rat,将nums中的数按照index的位置插入rat即可。 时间复杂度:O(n*n) 空间复杂度:O(n) ###代码 class Solution: def cre ...
分类:其他好文   时间:2020-12-04 11:06:02    阅读次数:6
leetcode第542题:01矩阵 [中等]
题目描述 image.png 考点 动态规划 解题思路 使用动态规划:我们从左上角到右下角进行一次动态搜索,再从右下到左上进行一次动态搜索。两次动态搜索即可完成四个方向的查找; 解题思路.png 代码实现 class Solution { public: vector<vector<int>> up ...
分类:其他好文   时间:2020-12-04 11:00:34    阅读次数:4
【leetcode】401. 二进制手表
void recursion(int* t, int minute, int hour, int n, int cur, int start, char** arr, int* pst){ if (minute >= 60 || hour >= 12) return; if (cur == n){ ...
分类:其他好文   时间:2020-12-04 10:57:49    阅读次数:8
剑指Offer12. 矩阵中的路径
题目:https://leetcode-cn.com/problems/ju-zhen-zhong-de-lu-jing-lcof/submissions/ 代码: class Solution { public boolean exist(char[][] board, String word) ...
分类:其他好文   时间:2020-12-03 12:21:11    阅读次数:6
LeetCode(92+206):反转单链表
入门版(206题) 题目描述 解题思路:迭代 使用cur和pre两个指针,一前一后(一左一右)地指向两个相邻节点 在每一轮迭代中: 用临时指针保存pre的next 让pre的next(掉头)指向cur cur和pre都沿着链表原来的方向,向前(右)走一步 当pre为空时,迭代结束 此时cur就是新链 ...
分类:其他好文   时间:2020-12-03 12:12:56    阅读次数:6
leetcode_110. 平衡二叉树
给定一个二叉树,判断它是否是高度平衡的二叉树。 本题中,一棵高度平衡二叉树定义为: 一个二叉树每个节点 的左右两个子树的高度差的绝对值不超过 1 。 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/balanced-binary-tree 著作 ...
分类:其他好文   时间:2020-12-03 11:59:09    阅读次数:6
34993条   上一页 1 ... 53 54 55 56 57 ... 3500 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!