发布时间:2015-01-30 12:35:29
Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(n) space is pretty straight forward. Could you devise a constant space solution?二叉排序树中有两个节点被交换了,要求把树恢复成二叉排序树。中序遍历二叉树生.........【阅读全文】
发布时间:2015-01-29 16:55:19
listview的控件复用了,需要把每个ToggleButton的状态保存起来private HashMap<Integer,Boolean> states=new HashMap<>();toogle.setOnCheckedChangeListener(new OnCheckedChangeListener() {@Overridepublic void onCheckedChanged(CompoundButton arg0, boolean arg1) {// TODO Auto-gen.........【阅读全文】
发布时间:2015-01-29 12:39:56
/You are given an n x n 2D matrix representing an image.////Rotate the image by 90 degrees (clockwise).////Follow up://Could you do this in-place?矩阵旋转问题:先对正对角线轴对称,在对垂直最中间的线轴对称。public class RotateImage {public void rotate(int[][] matrix) {int row=matrix.length.........【阅读全文】