EJ
(Move to ...)
Home
▼
Tuesday, March 27, 2018
4. Ugly Number
›
1*2(t2) 2*2 3*2 (t3)1*3 2*3 3*3 (t5)1*5 2*5 3*5 1*2 2*2(t2) 3*2 1*3(t3) 2*3 3*3 (t5)1*5 2*5 3*5 Solution: public int nthUglyNumbe...
12. Min Stack
›
Solution: 1) LinkedList Node head; public MinStack() { // do intialization if necessary head = null; } /* ...
Monday, March 26, 2018
104. Merge K Sorted Lists
›
Solution: 1) Divide and Conquer: /** * Definition for ListNode. * public class ListNode { * int val; * ListNode next; * ...
Saturday, March 24, 2018
107. WordBreak
›
LintCode: private int getMaxLength(Set<String> dict) { int maxLength = 0; for (String word : dict) { m...
Friday, March 23, 2018
191. Maximum Product Subarray
›
这道题是Maximum Subarray的follow up 应为乘法所以要考虑负负得正 所以同时记录最小值与最大值 max_products[i] = Math.max(Math.max(max_products[i-1] * nums[i],min_products[...
41. Maximum Subarray
›
现阶段的最大值等于max(前一位的最大值➕本身 , 本身) public class Solution { /** * @param nums: A list of integers * @return: A integer indicat...
Tuesday, March 20, 2018
120. Word Ladder
›
思路: 确认空集,开始词等于结束词的特殊情况 将start string放入queue length = 1 queue进行操作获取当前string的所有transformation 判断dict中是否存在transformation 判断hash中是否已经出现过...
›
Home
View web version