Thank you. Sorry for asking stupid questions
chris.su.522
@chris.su.522
Posts made by chris.su.522

RE: test case [[0,0],[94911151,94911150],[94911152,94911151]]

RE: Share my thoughts and Clean Java Code
At the glance of this problem, I'm thinking this is a transformation of K smallest number in an array.
Can't think better than binary search index and range.
Bravo! 
Java DP, Same as fibonacci
public int combinationSum4(int[] nums, int target) { if(nums == null) return 0; int[] dp = new int[target+1]; dp[0]=1; for(int i =0;i<=target;i++) for(int n:nums) if(i>=n) dp[i] +=dp[in]; return dp[target]; }
I was thinking it's complete knapsack problem. But actually it's not.
Since [1,1,2] and [1,2,1] is considered as different way here.
So we can think this is extended Fibonacci problem, where dp[i] += dp[k] where k is from 0, i1. 
min heap. nlogn. Java. Easy solution
public int minMeetingRooms(Interval[] intervals) { if(intervals== null  intervals.length == 0) return 0; Arrays.sort(intervals,(p1,p2)>p1.startp2.start); PriorityQueue<Interval> q = new PriorityQueue<Interval>((p1,p2)>p1.endp2.end ); for(Interval interval : intervals){ if(!q.isEmpty() && interval.start>=q.peek().end) q.poll(); q.add(interval); } return q.size(); }

easy java solution.
public int leastBricks(List<List<Integer>> wall) { HashMap<Integer,Integer> mapper = new HashMap<>(); int max = 0; for(List<Integer> row: wall){ int val=0; for(int i =0;i<row.size()1;i++){ val+=row.get(i); mapper.put(val,mapper.getOrDefault(val,0)+1); max = Math.max(max,mapper.get(val)); } } return wall.size()max; }
BTW, there must be some follow ups of this problem. But I can't think more of it.

RE: Java clear O(n logn) solution based on TreeMap
@cdai I like this solution!

RE: Short iterative Java solution
I like this solution because it's iterative. Unlike dfs, iterative is fast but hard to distinguish duplicates without using hashset.

RE: Single pass C++ O(n) space and time solution (8 lines) with detailed explanation.
I've struggled with this problem for two days...
Finally, I get this idea. This is so cool solution.
FYI, S3 here is actually the mid value. S2 is the high value. 
RE: Clean Java twopointers solution (no trim( ), no split( ), no StringBuilder)
This is supposed to be the highest accepted solution.
Resolve the problem from the bottom.
I don't understand why the answer with Java library got sooooo many upvotes.