Blog


[leetcode] Divide Two Integers

Divide Two Integers Divide two integers without using multiplication, division and mod operator. If it is overflow, return MAX_INT. tags: math, binary search 8/10/2015 update Reference http://yucoding.blogspot.com/2013/01/leetcode-question-28-divide-two-integers.html class Solution { public: int divide(int dividend, int divisor) { int flag = 1; long ldividend = dividend; long ldivisor = divisor; if(ldividend […]


[leetcode] Remove Element

Remove Element Given an array and a value, remove all instances of that value in place and return the new length. The order of elements can be changed. It doesn’t matter what you leave beyond the new length. 简单题,与上一题Remove Element in Sorted Array类似 class Solution { public: int removeElement(int A[], […]


[leetcode] Generate Parentheses

Generate Parentheses Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, a solution set is: “((()))”, “(()())”, “(())()”, “()(())”, “()()()” tag: backtracking 7/10/2015 udpate DFS approach, add some restrictions to guarantee the validation of parentheses class Solution { […]


[leetcode] Valid Parentheses

Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[‘ and ‘]’, determine if the input string is valid. The brackets must close in the correct order, “()” and “()[]{}” are all valid but “(]” and “([)]” are not. tag: stack, string 5/10/2015 update a neater approach, with […]


破解WIFI密码

相关文章: 1. Ubuntu下构建抓包环境。 forum.ubuntu.org.cn/viewtopic.php?t=383246 2.抓包软件minidwep-gtk-deb下载 http://forum.ubuntu.org.cn/viewtopic.php?f=39&t=372058&start=0 3.可能遇到的问题(软件运行无反应,光标在闪) blog.csdn.net/hackerwin7/article/details/42005771 4. libgtk-x11-2.0.so安装 http://blog.csdn.net/ljywk/article/details/39476143  


[leetcode] Sort List

Sort List Sort a linked list in O(n log n) time using constant space complexity. tag: list, sort 9/22/2015 update a cleaner solution /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class […]