08 2020 档案

摘要:Delete Node in a BST (M) 题目 Given a root node reference of a BST and a key, delete the node with the given key in the BST. Return the root node refere 阅读全文
posted @ 2020-08-31 20:01 墨云黑 阅读(169) 评论(0) 推荐(0)
摘要:Largest Component Size by Common Factor (H) 题目 Given a non-empty array of unique positive integers A, consider the following graph: There are A.length 阅读全文
posted @ 2020-08-31 10:55 墨云黑 阅读(159) 评论(0) 推荐(0)
摘要:Pancake Sorting (M) 题目 Given an array of integers A, We need to sort the array performing a series of pancake flips. In one pancake flip we do the fol 阅读全文
posted @ 2020-08-30 09:39 墨云黑 阅读(227) 评论(0) 推荐(0)
摘要:Implement Rand10() Using Rand7() (M) 题目 Given a function rand7 which generates a uniform random integer in the range 1 to 7, write a function rand10 w 阅读全文
posted @ 2020-08-29 12:30 墨云黑 阅读(186) 评论(0) 推荐(0)
摘要:Fizz Buzz (E) 题目 Write a program that outputs the string representation of numbers from 1 to n. But for multiples of three it should output “Fizz” ins 阅读全文
posted @ 2020-08-27 09:35 墨云黑 阅读(229) 评论(0) 推荐(0)
摘要:Minimum Cost For Tickets (M) 题目 In a country popular for train travel, you have planned some train travelling one year in advance. The days of the yea 阅读全文
posted @ 2020-08-26 11:56 墨云黑 阅读(180) 评论(0) 推荐(0)
摘要:Sum of Left Leaves (E) 题目 Find the sum of all left leaves in a given binary tree. Example: 3 / \ 9 20 / \ 15 7 There are two left leaves in the binary 阅读全文
posted @ 2020-08-25 09:51 墨云黑 阅读(144) 评论(0) 推荐(0)
摘要:Stream of Characters (H) 题目 Implement the StreamChecker class as follows: StreamChecker(words): Constructor, init the data structure with the given wo 阅读全文
posted @ 2020-08-24 10:50 墨云黑 阅读(175) 评论(0) 推荐(0)
摘要:Random Point in Non-overlapping Rectangles (M) 题目 Given a list of non-overlapping axis-aligned rectangles rects, write a function pick which randomly 阅读全文
posted @ 2020-08-23 13:38 墨云黑 阅读(168) 评论(0) 推荐(0)
摘要:Sort Array By Parity (E) 题目 Given an array A of non-negative integers, return an array consisting of all the even elements of A, followed by all the o 阅读全文
posted @ 2020-08-22 09:49 墨云黑 阅读(125) 评论(0) 推荐(0)
摘要:Reorder List (M) 题目 Given a singly linked list L: \(L_0→L_1→…→L_{n-1}→L_n\), reorder it to: \(L_0→L_n→L_1→L_{n-1}→L_2→L_{n-2}→…\) You may not modify t 阅读全文
posted @ 2020-08-21 09:32 墨云黑 阅读(166) 评论(0) 推荐(0)
摘要:Goat Latin (E) 题目 A sentence S is given, composed of words separated by spaces. Each word consists of lowercase and uppercase letters only. We would l 阅读全文
posted @ 2020-08-20 16:23 墨云黑 阅读(170) 评论(0) 推荐(0)
摘要:Numbers With Same Consecutive Differences (M) 题目 Return all non-negative integers of length N such that the absolute difference between every two cons 阅读全文
posted @ 2020-08-19 09:57 墨云黑 阅读(191) 评论(0) 推荐(0)
摘要:Distribute Candies to People (E) 题目 We distribute some number of candies, to a row of n = num_people people in the following way: We then give 1 candy 阅读全文
posted @ 2020-08-18 10:49 墨云黑 阅读(203) 评论(0) 推荐(0)
摘要:Best Time to Buy and Sell Stock III (H) 题目 Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm 阅读全文
posted @ 2020-08-17 14:19 墨云黑 阅读(118) 评论(0) 推荐(0)
摘要:Best Time to Buy and Sell Stock II (E) 题目 Say you have an array prices for which the ith element is the price of a given stock on day i. Design an alg 阅读全文
posted @ 2020-08-17 11:29 墨云黑 阅读(147) 评论(0) 推荐(0)
摘要:Longest Palindrome (E) 题目 Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be buil 阅读全文
posted @ 2020-08-15 12:13 墨云黑 阅读(129) 评论(0) 推荐(0)
摘要:Iterator for Combination (M) 题目 Design an Iterator class, which has: A constructor that takes a string characters of sorted distinct lowercase English 阅读全文
posted @ 2020-08-14 16:51 墨云黑 阅读(190) 评论(0) 推荐(0)
摘要:Pascal's Triangle II (E) 题目 Given a non-negative index k where k ≤ 33, return the \(k^{th}\) index row of the Pascal's triangle. Note that the row ind 阅读全文
posted @ 2020-08-13 10:02 墨云黑 阅读(153) 评论(0) 推荐(0)
摘要:Excel Sheet Column Number (E) 题目 Given a column title as appear in an Excel sheet, return its corresponding column number. For example: A -> 1 B -> 2 阅读全文
posted @ 2020-08-11 08:12 墨云黑 阅读(148) 评论(0) 推荐(0)
摘要:Rotting Oranges (M) 题目 In a given grid, each cell can have one of three values: the value 0 representing an empty cell; the value 1 representing a fre 阅读全文
posted @ 2020-08-10 11:18 墨云黑 阅读(182) 评论(0) 推荐(0)
摘要:Path Sum III (M) 题目 You are given a binary tree in which each node contains an integer value. Find the number of paths that sum to a given value. The 阅读全文
posted @ 2020-08-09 10:27 墨云黑 阅读(117) 评论(0) 推荐(0)
摘要:Vertical Order Traversal of a Binary Tree (M) 题目 Given a binary tree, return the vertical order traversal of its nodes values. For each node at positi 阅读全文
posted @ 2020-08-08 11:38 墨云黑 阅读(168) 评论(0) 推荐(0)
摘要:Find All Duplicates in an Array (M) 题目 Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once 阅读全文
posted @ 2020-08-07 09:23 墨云黑 阅读(130) 评论(0) 推荐(0)
摘要:Add and Search Word - Data structure design (M) 题目 Design a data structure that supports the following two operations: void addWord(word) bool search( 阅读全文
posted @ 2020-08-06 14:23 墨云黑 阅读(172) 评论(0) 推荐(0)
摘要:Implement Trie (Prefix Tree) (M) 题目 Implement a trie with insert, search, and startsWith methods. Example: Trie trie = new Trie(); trie.insert("apple" 阅读全文
posted @ 2020-08-06 13:58 墨云黑 阅读(146) 评论(0) 推荐(0)
摘要:Valid Palindrome (E) 题目 Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. Note: For the pu 阅读全文
posted @ 2020-08-03 21:32 墨云黑 阅读(118) 评论(0) 推荐(0)
摘要:Design HashSet (E) 题目 Design a HashSet without using any built-in hash table libraries. To be specific, your design should include these functions: ad 阅读全文
posted @ 2020-08-03 07:47 墨云黑 阅读(173) 评论(0) 推荐(0)
摘要:Detect Capital (E) 题目 Given a word, you need to judge whether the usage of capitals in it is right or not. We define the usage of capitals in a word t 阅读全文
posted @ 2020-08-02 09:29 墨云黑 阅读(161) 评论(0) 推荐(0)
摘要:Climbing Stairs (E) 题目 You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many d 阅读全文
posted @ 2020-08-01 09:57 墨云黑 阅读(191) 评论(0) 推荐(0)