https://www.cnblogs.com/grandyang/p/5144918.html 1. class Solution { public: int nthSuperUglyNumber(int n, vector<int>& primes) { vector<int> res(1,1) ...
分类:
其他好文 时间:
2020-06-30 10:56:23
阅读次数:
38
看了大佬的题解,茅塞顿开 public void solveSudoku(char[][] board) { if(board == null || board.length != 9 || board[0] == null || board[0].length != 9){ return; } b ...
分类:
其他好文 时间:
2020-06-30 10:39:23
阅读次数:
53
Given a list of airline tickets represented by pairs of departure and arrival airports [from, to], reconstruct the itinerary in order. All of the tick ...
分类:
其他好文 时间:
2020-06-30 09:15:20
阅读次数:
87
package LeetCode_128 /** * 128. Longest Consecutive Sequence * https://leetcode.com/problems/longest-consecutive-sequence/description/ * * Given an un ...
分类:
其他好文 时间:
2020-06-30 00:48:00
阅读次数:
48
非递归解法 递归解法比较简单,是考察概念,放在文章末尾来说。 用递归方法能解决的问题都能用非递归方法来实现,因为递归方法无非就是用函数栈来保存信息,如果用自己申请的数据结构来代替函数栈,也可以实现一样的功能 步骤: 1.申请一个栈,将头节点head压入栈中 2.从stack中弹出结点,记为temp, ...
分类:
其他好文 时间:
2020-06-30 00:41:42
阅读次数:
57
24. Swap Nodes in Pairs https://leetcode.com/problems/linked-list-cycle/ Given a linked list, swap every two adjacent nodes and return its head. You m ...
分类:
其他好文 时间:
2020-06-29 22:41:37
阅读次数:
55
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any p ...
分类:
其他好文 时间:
2020-06-29 20:01:24
阅读次数:
82
215. 数组中的第K个最大元素 题目来源:力扣(LeetCode)https://leetcode-cn.com/problems/kth-largest-element-in-an-array 题目 在未排序的数组中找到第 k 个最大的元素。请注意,你需要找的是数组排序后的第 k 个最大的元素, ...
分类:
编程语言 时间:
2020-06-29 19:59:13
阅读次数:
66
问题 ps:部分代码参考leetcode和剑指offer。另外,三道题目都可以通过HashMap和Hashset做 1、只出现一次的数字 给定一个非空整数数组,除了某个元素只出现一次以外,其余每个元素均出现两次。找出那个只出现了一次的元素。 def singleNumber(nums): """ 异 ...
分类:
其他好文 时间:
2020-06-29 16:53:37
阅读次数:
60
题目 在未排序的数组中找到第 k 个最大的元素。请注意,你需要找的是数组排序后的第 k 个最大的元素,而不是第 k 个不同的元素。 示例 1: 输入: [3,2,1,5,6,4] 和 k = 2 输出: 5 示例 2: 输入: [3,2,3,1,2,4,5,5,6] 和 k = 4 输出: 4 解法 ...
分类:
编程语言 时间:
2020-06-29 15:20:08
阅读次数:
66