02 2020 档案
摘要:题目: There are a total of n courses you have to take, labeled from 0 to n-1. Some courses may have prerequisites, for example to take course 0 you have
阅读全文
摘要:题目: Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer,
阅读全文
摘要:题目: Given a non-empty binary tree, find the maximum path sum. For this problem, a path is defined as any sequence of nodes from some starting node to
阅读全文
摘要:题目: Write a program to solve a Sudoku puzzle by filling the empty cells. A sudoku solution must satisfy all of the following rules: Each of the digits
阅读全文
摘要:题目: Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate
阅读全文
摘要:题目: Given two words word1 and word2, find the minimum number of operations required to convert word1 to word2. You have the following 3 operations per
阅读全文
摘要:题目: Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assume that the intervals were in
阅读全文
摘要:题目: Given a collection of intervals, merge all overlapping intervals. Example 1: Input: [[1,3],[2,6],[8,10],[15,18]] Output: [[1,6],[8,10],[15,18]] Ex
阅读全文
摘要:题目: In this problem, a rooted tree is a directed graph such that, there is exactly one node (the root) for which all other nodes are descendants of th
阅读全文
摘要:题目: Given a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is the length of the longest path b
阅读全文
摘要:题目: Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations in candidates where
阅读全文
摘要:题目: Given an unsorted array of integers, find the length of the longest consecutive elements sequence. Your algorithm should run in O(n) complexity. E
阅读全文
摘要:题目: On an NxN chessboard, a knight starts at the r-th row and c-th column and attempts to make exactly K moves. The rows and columns are 0 indexed, so
阅读全文
摘要:题目: Given a binary tree, find the length of the longest path where each node in the path has the same value. This path may or may not pass through the
阅读全文
摘要:题目: Given a string containing only three types of characters: '(', ')' and '*', write a function to check whether this string is valid. We define the
阅读全文
摘要:题目: 一个花园有N个位置。每个位置上有一朵花。这N朵花会在N天内逐一盛开。每天都一定会有并且只有一朵花盛开,从这天起,这朵花将一直处于盛开的状态。 给定一个由数字1到N组成的数组flowers。数组中的每个数字表示那一天将会盛开的花的位置。 例如,flowers[i] = x表示在位置x上的花会在
阅读全文
摘要:题目: You are given a data structure of employee information, which includes the employee's unique id, his importance value and his direct subordinates'
阅读全文
摘要:题目: In this problem, a tree is an undirected graph that is connected and has no cycles. The given input is a graph that started as a tree with N nodes
阅读全文
摘要:题目: Implement a trie with insert, search, and startsWith methods. Example: Trie trie = new Trie(); trie.insert("apple"); trie.search("apple"); // retu
阅读全文
摘要:题目: Given two words (beginWord and endWord), and a dictionary's word list, find all shortest transformation sequence(s) from beginWord to endWord, suc
阅读全文
摘要:题目: Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from beginWord to endWo
阅读全文
摘要:题目: 给定一个"HH:MM"格式的时间,重复使用这些数字,返回下一个最近的时间。每个数字可以被重复使用任意次。 保证输入的时间都是有效的。例如,"01:34","12:09" 都是有效的,而"1:34","12:9"都不是有效的时间。 样例 样例 1: 输入: "19:34" 输出: "19:39
阅读全文
摘要:题目: You're now a baseball game point recorder. Given a list of strings, each string can be one of the 4 following types: Integer (one round's score):
阅读全文
摘要:题目: A city's skyline is the outer contour of the silhouette formed by all the buildings in that city when viewed from a distance. Now suppose you are
阅读全文
摘要:问题描述: 自定义排序一个List<Pair<Integer, Integer>>,根据pair的key由小到大排序,如果相同,则根据pair的value由大到小排序。 最开始写的比较器如下: Collections.sort(list, new Comparator<Pair<Integer, I
阅读全文
摘要:错误描述: 使用JDBC连接数据库是产生错误 应该是数据库时区问题,在url配置时设置serverTimezone = GMT即可 url = "jdbc:mysql://localhost:3306/student?serverTimezone = GMT";
阅读全文
摘要:题目: https://leetcode.com/problems/friend-circles/ There are N students in a class. Some of them are friends, while some are not. Their friendship is t
阅读全文
摘要:题目: There is a strange printer with the following two special requirements: The printer can only print a sequence of the same character each time. At
阅读全文
摘要:题目: Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adj
阅读全文
摘要:题目: Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters.
阅读全文
摘要:加载驱动程序: Class.forName(driverClass) //加载MySql驱动 Class.forName("com.mysql.jdbc.Driver") //加载Oracle驱动 Class.forName("oracle.jdbc.driver.OracleDriver") 获得
阅读全文
摘要:题目: Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by its upper left corner (row1, col1) and lower right corner (
阅读全文
摘要:题目: Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area. Example: Input: 1 0 1 0 0 1 0 1
阅读全文
摘要:题目: Implement a MapSum class with insert, and sum methods. For the method insert, you'll be given a pair of (string, integer). The string represents t
阅读全文
摘要:题目: Given a non-empty string s, you may delete at most one character. Judge whether you can make it a palindrome. Example 1: Input: "aba" Output: True
阅读全文
摘要:题目: Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer,
阅读全文
LeetCode 381. Insert Delete GetRandom O(1) - Duplicates allowed O(1) 时间插入、删除和获取随机元素 - 允许重复(C++/Java)
摘要:题目: Design a data structure that supports all following operations in averageO(1) time. Note: Duplicate elements are allowed. insert(val): Inserts an
阅读全文

浙公网安备 33010602011771号