leetcode summary 09/13

409. Longest Palindrome use as many as char in odds add 1 if any odd exists 479. Largest Palindrome Product enumerate all situation from max to min 266. Palindrome Permutation only one odd count 267. Palindrome Permutation II

leetcode summary 09/06

517 Super Washing Machines the least steps we need to eventually finish this process is determined by the peak of abs(cnt) (accumulative count of gain/lose array) and the max of “gain/lose” array. >For a single machine, necessary operations is to transfer dresses from one side to another until sum of both sides and itself reaches the average number. We can calculate (required dresses) - (contained dresses) of each side as L and R: L > 0 && R > 0: both sides lacks dresses, and we can only export one dress from current machines at a time, so result is abs(L) + abs® L < 0 && R < 0: both sides contains too many dresses, and we can import dresses from both sides at the same time, so result is max(abs(L), abs®) L < 0 && R > 0 or L >0 && R < 0: the side with a larger absolute value will import/export its extra dresses from/to current machine or other side, so result is max(abs(L), abs®)

Algorithm - leetcode

692. Top K Frequent Words 2017-10-15 682. Baseball Game 2017-09-23 677. Map Sum Pairs 2017-09-23 647. Palindromic Substrings 2017-09-06 624. Maximum Distance in Arrays 2017-11-04 598. Range Addition II 2017-10-22 592. Fraction Addition and Subtraction 2017-10-22 566. Reshape the Matrix 2017-10-09 564. Find the Closest Palindrome 2017-09-06 532. K-diff Pairs in an Array 2017-09-04 529. Minesweepe 2017-09-06 518. Coin Change 2 2017-10-19 517. Super Washing Machines 2017-09-06 516. Longest Palindromic Subsequence 2017-09-05

leetcode summary 09/05

516 Longest Palindromic Subsequence O(2^n) Brute force. If the two ends of a string are the same, then they must be included in the longest palindrome subsequence. Otherwise, both ends cannot be included in the longest palindrome subsequence. O(n^2) memo the result from left to right. also rewrite in dp fashion 508 Most Frequent Subtree Sum postOrder and check count