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)

导航