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 阅读全文
posted @ 2020-02-29 15:27 silentteller 阅读(299) 评论(0) 推荐(0)
摘要:题目: 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, 阅读全文
posted @ 2020-02-29 14:44 silentteller 阅读(301) 评论(0) 推荐(0)
摘要:题目: 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 阅读全文
posted @ 2020-02-28 12:35 silentteller 阅读(283) 评论(0) 推荐(0)
摘要:题目: 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 阅读全文
posted @ 2020-02-27 15:53 silentteller 阅读(259) 评论(0) 推荐(0)
摘要:题目: Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate 阅读全文
posted @ 2020-02-27 14:59 silentteller 阅读(213) 评论(0) 推荐(0)
摘要:题目: 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 阅读全文
posted @ 2020-02-26 15:05 silentteller 阅读(414) 评论(0) 推荐(0)
摘要:题目: 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 阅读全文
posted @ 2020-02-26 13:49 silentteller 阅读(247) 评论(0) 推荐(0)
摘要:题目: 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 阅读全文
posted @ 2020-02-26 12:58 silentteller 阅读(619) 评论(0) 推荐(0)
摘要:题目: 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 阅读全文
posted @ 2020-02-25 14:52 silentteller 阅读(270) 评论(0) 推荐(0)
摘要:题目: 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 阅读全文
posted @ 2020-02-24 17:17 silentteller 阅读(388) 评论(0) 推荐(0)
摘要:题目: Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations in candidates where 阅读全文
posted @ 2020-02-24 16:46 silentteller 阅读(352) 评论(0) 推荐(0)
摘要:题目: Given an unsorted array of integers, find the length of the longest consecutive elements sequence. Your algorithm should run in O(n) complexity. E 阅读全文
posted @ 2020-02-24 16:01 silentteller 阅读(270) 评论(0) 推荐(0)
摘要:题目: 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 阅读全文
posted @ 2020-02-23 19:57 silentteller 阅读(263) 评论(0) 推荐(0)
摘要:题目: 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 阅读全文
posted @ 2020-02-23 18:59 silentteller 阅读(331) 评论(0) 推荐(0)
摘要:题目: Given a string containing only three types of characters: '(', ')' and '*', write a function to check whether this string is valid. We define the 阅读全文
posted @ 2020-02-22 23:27 silentteller 阅读(281) 评论(0) 推荐(0)
摘要:题目: 一个花园有N个位置。每个位置上有一朵花。这N朵花会在N天内逐一盛开。每天都一定会有并且只有一朵花盛开,从这天起,这朵花将一直处于盛开的状态。 给定一个由数字1到N组成的数组flowers。数组中的每个数字表示那一天将会盛开的花的位置。 例如,flowers[i] = x表示在位置x上的花会在 阅读全文
posted @ 2020-02-22 20:40 silentteller 阅读(316) 评论(0) 推荐(0)
摘要:题目: You are given a data structure of employee information, which includes the employee's unique id, his importance value and his direct subordinates' 阅读全文
posted @ 2020-02-21 22:33 silentteller 阅读(373) 评论(1) 推荐(0)
摘要:题目: 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 阅读全文
posted @ 2020-02-21 21:45 silentteller 阅读(250) 评论(0) 推荐(0)
摘要:题目: Implement a trie with insert, search, and startsWith methods. Example: Trie trie = new Trie(); trie.insert("apple"); trie.search("apple"); // retu 阅读全文
posted @ 2020-02-21 20:16 silentteller 阅读(273) 评论(0) 推荐(0)
摘要:题目: Given two words (beginWord and endWord), and a dictionary's word list, find all shortest transformation sequence(s) from beginWord to endWord, suc 阅读全文
posted @ 2020-02-20 23:58 silentteller 阅读(338) 评论(0) 推荐(0)
摘要:题目: Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from beginWord to endWo 阅读全文
posted @ 2020-02-17 22:34 silentteller 阅读(500) 评论(0) 推荐(0)
摘要:题目: 给定一个"HH:MM"格式的时间,重复使用这些数字,返回下一个最近的时间。每个数字可以被重复使用任意次。 保证输入的时间都是有效的。例如,"01:34","12:09" 都是有效的,而"1:34","12:9"都不是有效的时间。 样例 样例 1: 输入: "19:34" 输出: "19:39 阅读全文
posted @ 2020-02-16 22:14 silentteller 阅读(925) 评论(0) 推荐(0)
摘要:题目: 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): 阅读全文
posted @ 2020-02-16 22:02 silentteller 阅读(475) 评论(0) 推荐(0)
摘要:题目: 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  阅读全文
posted @ 2020-02-15 21:27 silentteller 阅读(608) 评论(0) 推荐(0)
摘要:问题描述: 自定义排序一个List<Pair<Integer, Integer>>,根据pair的key由小到大排序,如果相同,则根据pair的value由大到小排序。 最开始写的比较器如下: Collections.sort(list, new Comparator<Pair<Integer, I 阅读全文
posted @ 2020-02-15 16:31 silentteller 阅读(1669) 评论(0) 推荐(0)
摘要:错误描述: 使用JDBC连接数据库是产生错误 应该是数据库时区问题,在url配置时设置serverTimezone = GMT即可 url = "jdbc:mysql://localhost:3306/student?serverTimezone = GMT"; 阅读全文
posted @ 2020-02-14 20:47 silentteller 阅读(2007) 评论(0) 推荐(1)
摘要:题目: 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 阅读全文
posted @ 2020-02-13 21:08 silentteller 阅读(456) 评论(0) 推荐(0)
摘要:题目: 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 阅读全文
posted @ 2020-02-13 19:50 silentteller 阅读(323) 评论(0) 推荐(0)
摘要:题目: 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 阅读全文
posted @ 2020-02-12 22:38 silentteller 阅读(514) 评论(0) 推荐(0)
摘要:题目: Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters. 阅读全文
posted @ 2020-02-12 22:02 silentteller 阅读(225) 评论(0) 推荐(0)
摘要:加载驱动程序: Class.forName(driverClass) //加载MySql驱动 Class.forName("com.mysql.jdbc.Driver") //加载Oracle驱动 Class.forName("oracle.jdbc.driver.OracleDriver") 获得 阅读全文
posted @ 2020-02-12 17:04 silentteller 阅读(179) 评论(0) 推荐(0)
摘要:题目: 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 ( 阅读全文
posted @ 2020-02-11 23:15 silentteller 阅读(242) 评论(0) 推荐(0)
摘要:题目: 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 阅读全文
posted @ 2020-02-11 21:51 silentteller 阅读(465) 评论(0) 推荐(0)
摘要:题目: 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 阅读全文
posted @ 2020-02-10 23:11 silentteller 阅读(226) 评论(0) 推荐(0)
摘要:题目: 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 阅读全文
posted @ 2020-02-10 22:27 silentteller 阅读(290) 评论(0) 推荐(0)
摘要:题目: 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, 阅读全文
posted @ 2020-02-10 00:20 silentteller 阅读(268) 评论(0) 推荐(0)
摘要:题目: Design a data structure that supports all following operations in averageO(1) time. Note: Duplicate elements are allowed. insert(val): Inserts an 阅读全文
posted @ 2020-02-08 21:56 silentteller 阅读(261) 评论(0) 推荐(0)