码迷,mamicode.com
首页 >  
搜索关键字:given a n n matrix    ( 24496个结果
剑指 Offer 04. 二维数组中的查找
//暴力法 时间复杂度 O(m * n) //根据排序的规律观察,得到类似2叉搜索树的解法 O(m + n) class Solution { public boolean findNumberIn2DArray(int[][] matrix, int target) { //判空 if(matri ...
分类:编程语言   时间:2020-12-17 12:41:42    阅读次数:1
Leetcode 725. Split Linked List in Parts
Description: Given a (singly) linked list with head node root, write a function to split the linked list into k consecutive linked list "parts". The l ...
分类:其他好文   时间:2020-12-14 13:00:34    阅读次数:3
LG P4351 [CERC2015]Frightful Formula
Description A frightful matrix is a square matrix of order n where the first row and the first column are explicitly specified, while the other elemen ...
分类:其他好文   时间:2020-12-11 11:54:24    阅读次数:4
CF884E Binary Matrix(并查集)
初一看,sb题,上去一个并查集,很快啊,返回一个MLE,定睛一看,系统开的内存很小,但是这个算法复杂度又是这么正确 因此考虑优化内存,这样用滚动数组优化即可 #include<bits/stdc++.h> using namespace std; typedef long long ll; type ...
分类:其他好文   时间:2020-12-10 11:39:56    阅读次数:13
[LeetCode] 79. Word Search(单词查找)
Difficulty: Medium Related Topics: Array, Backtracking Link: https://leetcode.com/problems/word-search/ Description Given an m x n board and a word, f ...
分类:其他好文   时间:2020-12-10 11:30:28    阅读次数:11
220. Contains Duplicate III(核心:set数组有序/桶排序)
Given an array of integers, find out whether there are two distinct indices i and j in the array such that the absolute difference between nums[i] and ...
分类:编程语言   时间:2020-12-10 11:13:48    阅读次数:6
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 #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
力扣 - 74. 搜索二维矩阵
题目 74. 搜索二维矩阵 思路1(暴力) 遍历二维数组的所有的元素,看看是否存在target 代码 class Solution { public boolean searchMatrix(int[][] matrix, int target) { for (int i = 0; i < matr ...
分类:其他好文   时间:2020-12-03 11:50:12    阅读次数:4
24496条   上一页 1 ... 14 15 16 17 18 ... 2450 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!