摘要:
Compare two version numbersversion1andversion2.Ifversion1>version2return 1, ifversion1v2) return 1; if(v1<v2) return -1; ... 阅读全文
摘要:
Given an unsorted array, find the maximum difference between the successive elements in its sorted form.Try to solve it in linear time/space.Return 0 ... 阅读全文
摘要:
Given two strings S and T, determine if they are both one edit distance apart.Hint:1. If | n – m | is greater than 1, we know immediately both are not... 阅读全文
摘要:
网上抄的http://blog.csdn.net/whuwangyi/article/details/43186045Given a binary tree where all the right nodes are either leaf nodes with a sibling (a left ... 阅读全文
摘要:
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -- Removes... 阅读全文
摘要:
话说我们昨晚去看了侏罗纪公园,原来xd就是我最爱的巨幕,来美国这么多年了,怀念和小星星一路成长,一路看电影的经历,avatar是我们在美国一起看的第一部电影。老美看完好片子,还喜欢鼓个掌。这题one pass in place就是麻烦,要多做个string来判断单词要用到sb的insert,不过可以... 阅读全文
摘要:
很简单的stack,注意operation orderpublic class Solution { public int evalRPN(String[] tokens) { if(tokens ==null|| tokens.length==0) return 0; ... 阅读全文
摘要:
http://bookshadow.com/weblog/2015/01/19/leetcode-binary-tree-postorder-traversal/http://bookshadow.com/weblog/2015/01/19/binary-tree-post-order-traver... 阅读全文
摘要:
ref linkhttp://blog.sina.com.cn/s/blog_eb52001d0102v1si.html摘抄感谢以下文章的作者:BIN大神的大总结:http://blog.csdn.net/fightforyourdream/article/details/16843303 面试... 阅读全文
摘要:
树的遍历当初觉得难死,现在还好public class Solution { public ArrayList preorderTraversal(TreeNode root) { ArrayList res = new ArrayList(); if(root=... 阅读全文