上一页 1 2 3 4 5 6 7 ··· 15 下一页

2018年11月9日

819. Most Common Word

摘要: Given a paragraph and a list of banned words, return the most frequent word that is not in the list of banned words. It is guaranteed there is at least one word that isn't banned, and that the answe... 阅读全文

posted @ 2018-11-09 06:37 猪猪🐷 阅读(100) 评论(0) 推荐(0)

703. Kth Largest Element in a Stream

摘要: Design a class to find the kth largest element in a stream. Note that it is the kth largest element in the sorted order, not the kth distinct element. Your KthLargest class will have a constructor w... 阅读全文

posted @ 2018-11-09 06:36 猪猪🐷 阅读(126) 评论(0) 推荐(0)

48. Rotate Image

摘要: https://leetcode.com/problems/rotate-image/discuss/18872/A-common-method-to-rotate-the-image 这个题用 正常的做法写一遍, 因为面试的时候, 这样是正常人的理解 https://www.youtube.com/watch?v=9ryIfj5DohI&t=386s Given input matr... 阅读全文

posted @ 2018-11-09 06:34 猪猪🐷 阅读(116) 评论(0) 推荐(0)

2018年11月8日

36. Valid Sudoku

摘要: Determine if a 9x9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules: 1. Each row must contain the digits 1-9 without repetition. 2. Each column mu... 阅读全文

posted @ 2018-11-08 17:08 猪猪🐷 阅读(107) 评论(0) 推荐(0)

ood1

摘要: public class Employee{ static double bonusRate = 0.1; final String name; final String id; int age; int salary; int level; Employee(String name, int age, String id, int le... 阅读全文

posted @ 2018-11-08 17:07 猪猪🐷 阅读(233) 评论(0) 推荐(0)

ood nov 2018

摘要: ood Take it slow , if you understand it, u don’t have to memorize it. The more you understand a thing , the less you need to memorize it Odd standard 阅读全文

posted @ 2018-11-08 17:06 猪猪🐷 阅读(231) 评论(0) 推荐(0)

166. Fraction to Recurring Decimal

摘要: Given two integers representing the numerator and denominator of a fraction, return the fraction in string format. If the fractional part is repeating 阅读全文

posted @ 2018-11-08 17:05 猪猪🐷 阅读(167) 评论(0) 推荐(0)

System design nov 2018

摘要: https://medium.baqend.com/nosql-databases-a-survey-and-decision-guidance-ea7823a822d What are horizontal and vertical partitions in database and what 阅读全文

posted @ 2018-11-08 17:05 猪猪🐷 阅读(204) 评论(0) 推荐(0)

535. Encode and Decode TinyURL

摘要: 535. Encode and Decode TinyURL Note: This is a companion problem to the System Design problem: Design TinyURL. TinyURL is a URL shortening service where you enter a URL such as https://leetcode.com/... 阅读全文

posted @ 2018-11-08 17:04 猪猪🐷 阅读(164) 评论(0) 推荐(0)

568. Maximum Vacation Days

摘要: 需要把这道题从brute force 分析, 然后找到重复的计算, 然后一步步优化, 一直到 一维dp. 分析时间复杂度 https://www.youtube.com/watch?v=_MYkrCfFb4M LeetCode wants to give one of its best employees the option to travel among N cities to c... 阅读全文

posted @ 2018-11-08 17:02 猪猪🐷 阅读(200) 评论(0) 推荐(0)

904. Fruit Into Baskets

摘要: In a row of trees, the i-th tree produces fruit with type tree[i]. You start at any tree of your choice, then repeatedly perform the following steps: 1. Add one piece of fruit from this tree to your ... 阅读全文

posted @ 2018-11-08 17:01 猪猪🐷 阅读(201) 评论(0) 推荐(0)

464. Can I Win

摘要: In the "100 game," two players take turns adding, to a running total, any integer from 1..10. The player who first causes the running total to reach or exceed 100 wins. What if we change the game so ... 阅读全文

posted @ 2018-11-08 17:01 猪猪🐷 阅读(200) 评论(0) 推荐(0)

857. Minimum Cost to Hire K Workers

摘要: There are N workers. The i-th worker has a quality[i] and a minimum wage expectation wage[i]. Now we want to hire exactly K workers to form a paid group. When hiring a group of K workers, we must ... 阅读全文

posted @ 2018-11-08 17:00 猪猪🐷 阅读(199) 评论(0) 推荐(0)

803. Bricks Falling When Hit

摘要: 看不懂 union find 的代码 https://leetcode.com/problems/bricks-falling-when-hit/discuss/141229/JAVA-Simple-DFS-16ms-reversely-add-bricks-back Very clever idea using -1 to stop visiting the points already ... 阅读全文

posted @ 2018-11-08 16:58 猪猪🐷 阅读(190) 评论(0) 推荐(0)

486. Predict the Winner

摘要: https://www.youtube.com/watch?v=g5wLHFTodm0 https://leetcode.com/problems/predict-the-winner/solution/ https://www.cnblogs.com/liujinhong/p/6477367.ht 阅读全文

posted @ 2018-11-08 16:57 猪猪🐷 阅读(112) 评论(0) 推荐(0)

41. First Missing Positive

摘要: Given an unsorted integer array, find the smallest missing positive integer. Example 1: Input: [1,2,0] Output: 3 Example 2: Input: [3,4,-1,1] Output: 阅读全文

posted @ 2018-11-08 16:56 猪猪🐷 阅读(101) 评论(0) 推荐(0)

68. Text Justification

摘要: it teaches you in the real world. Programmers are always been ask to deal with dirty works. Besides detail-oriented mindset, I think this question als 阅读全文

posted @ 2018-11-08 16:54 猪猪🐷 阅读(121) 评论(0) 推荐(0)

218. The Skyline Problem

摘要: https://www.youtube.com/watch?v=8Kd-Tn_Rz7s Java有TreeMap和TreeSet。 阅读全文

posted @ 2018-11-08 16:53 猪猪🐷 阅读(60) 评论(0) 推荐(0)

134. Gas Station

摘要: There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. You have a car with an unlimited gas tank and it cost 阅读全文

posted @ 2018-11-08 16:53 猪猪🐷 阅读(106) 评论(0) 推荐(0)

222. Count Complete Tree Nodes

摘要: https://leetcode.com/problems/count-complete-tree-nodes/discuss/61958/Concise-Java-solutions-O(log(n)2) 阅读全文

posted @ 2018-11-08 16:52 猪猪🐷 阅读(94) 评论(0) 推荐(0)

248. Strobogrammatic Number III

摘要: (3)找出1-650中所有的ambiguous number,定义:如果把一个数upside down还是一个有效数的话,这个数就是ambiguous,比如19 -> 61, follow up找到1-n中的这种数 A strobogrammatic number is a number that looks the same when rotated 180 degrees (look... 阅读全文

posted @ 2018-11-08 16:44 猪猪🐷 阅读(137) 评论(0) 推荐(0)

370 Range Addition

摘要: Assume you have an array of length n initialized with all 0's and are given k update operations. Each operation is represented as a triplet: [startIndex, endIndex, inc] which increments each element ... 阅读全文

posted @ 2018-11-08 16:41 猪猪🐷 阅读(61) 评论(0) 推荐(0)

373 Find K Pairs with Smallest Sums

摘要: https://leetcode.com/problems/find-k-pairs-with-smallest-sums/discuss/84551/simple-Java-O(KlogK)-solution-with-explanation public class Solution { public List kSmallestPairs(int[] nums1, int[... 阅读全文

posted @ 2018-11-08 16:40 猪猪🐷 阅读(113) 评论(0) 推荐(0)

375. Guess Number Higher or Lower II

摘要: We are playing the Guess Game. The game is as follows: I pick a number from 1 to n. You have to guess which number I picked. Every time you guess wrong, I'll tell you whether the number I picked is h... 阅读全文

posted @ 2018-11-08 16:40 猪猪🐷 阅读(113) 评论(0) 推荐(0)

419. Battleships in a Board

摘要: Given an 2D board, count how many battleships are in it. The battleships are represented with 'X's, empty slots are represented with '.'s. You may assume the following rules: * You receive a valid bo... 阅读全文

posted @ 2018-11-08 16:38 猪猪🐷 阅读(135) 评论(0) 推荐(0)

447. Number of Boomerangs

摘要: Given n points in the plane that are all pairwise distinct, a "boomerang" is a tuple of points (i, j, k) such that the distance between i and j equals the distance between i and k (the order of the t... 阅读全文

posted @ 2018-11-08 16:37 猪猪🐷 阅读(114) 评论(0) 推荐(0)

482. License Key Formatting

摘要: You are given a license key represented as a string S which consists only alphanumeric character and dashes. The string is separated into N+1 groups b 阅读全文

posted @ 2018-11-08 16:36 猪猪🐷 阅读(96) 评论(0) 推荐(0)

529. Minesweeper

摘要: Let's play the minesweeper game (Wikipedia, online game)! You are given a 2D char matrix representing the game board. 'M' represents an unrevealed min 阅读全文

posted @ 2018-11-08 16:35 猪猪🐷 阅读(151) 评论(0) 推荐(0)

562. Longest Line of Consecutive One in Matrix

摘要: https://leetcode.com/problems/longest-line-of-consecutive-one-in-matrix/solution/ Given a 01 matrix M, find the longest line of consecutive one in the matrix. The line could be horizontal, vertical... 阅读全文

posted @ 2018-11-08 16:34 猪猪🐷 阅读(119) 评论(0) 推荐(0)

312. Burst Balloons

摘要: Given n balloons, indexed from 0 to n-1. Each balloon is painted with a number on it represented by array nums. You are asked to burst all the balloons. If the you burst balloon i you will get nums[l... 阅读全文

posted @ 2018-11-08 16:33 猪猪🐷 阅读(136) 评论(0) 推荐(0)

659. Split Array into Consecutive Subsequences

摘要: 659. Split Array into Consecutive Subsequences 阅读全文

posted @ 2018-11-08 16:32 猪猪🐷 阅读(84) 评论(0) 推荐(0)

695. Max Area of Island

摘要: Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four edges of the grid are surro... 阅读全文

posted @ 2018-11-08 16:29 猪猪🐷 阅读(151) 评论(0) 推荐(0)

457. Circular Array Loop

摘要: 457. Circular Array Loop http://www.cnblogs.com/grandyang/p/7658128.html https://www.youtube.com/watch?v=VX2oZkDJeGA 阅读全文

posted @ 2018-11-08 16:27 猪猪🐷 阅读(130) 评论(0) 推荐(0)

475. Heaters

摘要: java.util.Arrays.binarySearch() method public static int binarySearch(int[] a, int key) Parameters * a − This is the array to be searched. * key − This is the value to be searched for. This method... 阅读全文

posted @ 2018-11-08 16:26 猪猪🐷 阅读(140) 评论(0) 推荐(0)

701. Insert into a Binary Search Tree

摘要: Given the root node of a binary search tree (BST) and a value to be inserted into the tree, insert the value into the BST. Return the root node of the BST after the insertion. It is guaranteed that t... 阅读全文

posted @ 2018-11-08 16:24 猪猪🐷 阅读(83) 评论(0) 推荐(0)

428. Serialize and Deserialize N-ary Tree

摘要: 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, or 阅读全文

posted @ 2018-11-08 16:23 猪猪🐷 阅读(123) 评论(0) 推荐(0)

725. Split Linked List in Parts

摘要: https://leetcode.com/problems/split-linked-list-in-parts/solution/ 阅读全文

posted @ 2018-11-08 16:22 猪猪🐷 阅读(61) 评论(0) 推荐(0)

859. Buddy Strings

摘要: Given two strings A and B of lowercase letters, return true if and only if we can swap two letters in A so that the result equals B. Example 1: Input: A = "ab", B = "ba" Output: true Example 2: ... 阅读全文

posted @ 2018-11-08 16:21 猪猪🐷 阅读(112) 评论(0) 推荐(0)

850. Rectangle Area II

摘要: 850. Rectangle Area II Segment tree 阅读全文

posted @ 2018-11-08 16:18 猪猪🐷 阅读(157) 评论(0) 推荐(0)

863. All Nodes Distance K in Binary Tree

摘要: We are given a binary tree (with root node root), a target node, and an integer value K. Return a list of the values of all nodes that have a distance 阅读全文

posted @ 2018-11-08 16:17 猪猪🐷 阅读(173) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 ··· 15 下一页

导航