HashTable
weixin_39145266
这个作者很懒,什么都没留下…
展开
-
314 Binary Tree Vertical Order Traversal
1 题目Given a binary tree, return thevertical ordertraversal of its nodes' values. (ie, from top to bottom, column by column).If two nodes are in the same row and column, the order should be from...原创 2020-01-06 06:52:23 · 114 阅读 · 0 评论 -
957 Prison Cells After N Days
1 题目There are 8 prison cells in a row, and each cell is either occupied or vacant.Each day, whether the cell is occupied or vacant changes according to the following rules:If a cell has two adja...原创 2019-12-01 07:40:28 · 93 阅读 · 0 评论 -
692 Top K Frequent Words
1 题目Given a non-empty list of words, return thekmost frequent elements.Your answer should be sorted by frequency from highest to lowest. If two words have the same frequency, then the word with ...原创 2019-11-26 12:54:55 · 49 阅读 · 0 评论 -
409 Longest Palindrome
1 题目Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters.This is case sensitive, for example"Aa"is not...原创 2019-11-21 03:27:44 · 52 阅读 · 0 评论 -
1 Two Sum
1 题目Given an array of integers, returnindicesof the two numbers such that they add up to a specific target.You may assume that each input would haveexactlyone solution, and you may not use the...原创 2019-10-02 04:46:06 · 55 阅读 · 0 评论 -
718 Maximum Length of Repeated Subarray
1 题目Given two integer arraysAandB, return the maximum length of an subarray that appears in both arrays.Example 1:Input:A: [1,2,3,2,1]B: [3,2,1,4,7]Output: 3Explanation: The repeated su...原创 2019-08-03 12:25:23 · 57 阅读 · 0 评论 -
380 Insert Delete GetRandom O(1)
1 题目Design a data structure that supports all following operations inaverageO(1)time.insert(val): Inserts an item val to the set if not already present. remove(val): Removes an item val fro...原创 2019-07-13 20:33:16 · 59 阅读 · 0 评论 -
387 First Unique Character in a String
1 题目Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1.Examples:s = "leetcode"return 0.s = "loveleetcode",return 2.Note:Yo...原创 2019-05-07 16:08:04 · 61 阅读 · 0 评论 -
204 Count Primes
1 题目Count the number of prime numbers less than a non-negative number,n.Example:Input: 10Output: 4Explanation: There are 4 prime numbers less than 10, they are 2, 3, 5, 7.2 尝试解2.1 分析从2...原创 2019-04-26 17:46:15 · 82 阅读 · 0 评论 -
166 Fraction to Recurring Decimal
1 题目Given two integers representing the numerator and denominator of a fraction, return the fraction in string format.If the fractional part is repeating, enclose the repeating part in parentheses...原创 2019-04-03 10:22:03 · 168 阅读 · 0 评论 -
138 Copy List with Random Pointer
1 题目A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Return adeep copyof the list.Example 1:Input:{"$...原创 2019-04-02 14:01:21 · 91 阅读 · 0 评论 -
299 Bulls and Cows
1 题目You are playing the followingBulls and Cowsgame with your friend: You write down a number and ask your friend to guess what the number is. Each time your friend makes a guess, you provide a hi...原创 2019-04-05 08:13:36 · 520 阅读 · 0 评论 -
274 H-Index
1 题目Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index.According to thedefinition of h-index on Wikipedia:...原创 2019-04-04 23:50:29 · 119 阅读 · 0 评论 -
187 Repeated DNA Sequences
1 题目All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studying DNA, it is sometimes useful to identify repeated sequences within the DNA....原创 2019-04-04 23:13:26 · 84 阅读 · 0 评论 -
94 Binary Tree Inorder Traversal
1 题目Given a binary tree, return theinordertraversal of its nodes' values.2 尝试解class Solution {public: vector<int> inorderTraversal(TreeNode* root) { vector<int> resul...原创 2019-03-29 09:19:02 · 54 阅读 · 0 评论 -
49 Group Anagrams
1 题目Given an array of strings, group anagrams together.2 尝试解class Solution {public: vector<vector<string>> groupAnagrams(vector<string>& strs) { map<string...原创 2019-03-29 09:19:12 · 59 阅读 · 0 评论 -
36 Valid Sudoku
1 题目Determine if a9x9 Sudoku boardis valid.Only the filled cells need to be validatedaccording to the following rules:Each rowmust contain thedigits1-9without repetition. Each column must...原创 2019-03-29 09:15:59 · 60 阅读 · 0 评论