随笔分类 -  LeetCode

摘要:题目: 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 阅读(279) 评论(0) 推荐(0)
摘要:题目: 一个花园有N个位置。每个位置上有一朵花。这N朵花会在N天内逐一盛开。每天都一定会有并且只有一朵花盛开,从这天起,这朵花将一直处于盛开的状态。 给定一个由数字1到N组成的数组flowers。数组中的每个数字表示那一天将会盛开的花的位置。 例如,flowers[i] = x表示在位置x上的花会在 阅读全文
posted @ 2020-02-22 20:40 silentteller 阅读(313) 评论(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 阅读(369) 评论(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 阅读(248) 评论(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 阅读(271) 评论(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 阅读(336) 评论(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 阅读(498) 评论(0) 推荐(0)
摘要:题目: 给定一个"HH:MM"格式的时间,重复使用这些数字,返回下一个最近的时间。每个数字可以被重复使用任意次。 保证输入的时间都是有效的。例如,"01:34","12:09" 都是有效的,而"1:34","12:9"都不是有效的时间。 样例 样例 1: 输入: "19:34" 输出: "19:39 阅读全文
posted @ 2020-02-16 22:14 silentteller 阅读(922) 评论(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 阅读(470) 评论(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 阅读(605) 评论(0) 推荐(0)
摘要:题目: 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 阅读(449) 评论(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 阅读(505) 评论(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)
摘要:题目: 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 阅读(236) 评论(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 阅读(462) 评论(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 阅读(224) 评论(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 阅读(289) 评论(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 阅读(267) 评论(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 阅读(257) 评论(0) 推荐(0)