Roger Everett
Pages
(Move to ...)
Home
About me
Outline
▼
10/02/2014
Leetcode -- Maximum Product Subarray
›
Made a really complicated and ugly solution, will refactor later: public class Solution { public int maxProduct(int[] A) { Li...
6/15/2014
Evaluate Math Expression
›
A hacky way with python is quite simple print eval('1+ 2*3 - 5', {'__builtins__' : None}) Otherwise, we assume there is n...
6/08/2014
Leetcode -- Interleaving String
›
class Solution { public: bool isInterleave(string s1, string s2, string s3) { int n1 = s1.size(); int n2 = s2.size();...
Leetcode -- Recover Binary Search Tree
›
/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * Tre...
6/07/2014
Leetcode -- Convert Sorted List to Binary Search Tree
›
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : va...
6/03/2014
Leetcode -- Surrounding Regions
›
Basically just copied from Internet. class Solution { public: void solve(vector<vector<char>> &board) { if(...
6/01/2014
Leetcode -- Candy
›
Scan from both beginning and back, catch the strictly increasing and strictly decreasing ratings. When do the backward scan, be careful that...
›
Home
View web version