原题地址:https://oj.leetcode.com/problems/search-a-2d-matrix/题意:Write
an efficient algorithm that searches for a value in anmxnmatrix. This matrix has
the...
分类:
编程语言 时间:
2014-06-29 07:56:13
阅读次数:
321
MainActivity如下:
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.ImageView;
import android.app.Acti...
分类:
移动开发 时间:
2014-06-29 07:18:53
阅读次数:
1336
题目
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.
方法
数组是有序的,要求创建的二叉树尽量平衡,很容易想到对数组进行二分操作,左边的数组元素是左子树,右边的数组元素是右子树。进行递归操作就可以了。
TreeNode...
分类:
其他好文 时间:
2014-06-20 11:06:46
阅读次数:
257
MainActivity如下:
package cc.c;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
...
分类:
移动开发 时间:
2014-06-20 10:07:11
阅读次数:
265
题目
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.
方法
和有序数组的思想基本一样,将链表进行二分。
TreeNode getBST(ListNode head, int len) {
i...
分类:
其他好文 时间:
2014-06-20 09:46:33
阅读次数:
267
开发中遇到一些涉及到Matrix的地方,现在此归纳,便于日后查阅。
通过对ImageView设置Matrix来实现ImageView中图片的单指拖动和两指缩放
核心方法:
imageView.setImageMatrix(matrix);
所以我们的重点在于去操作一个Matrix.
该处主要用到的是利用Matrix实现缩放(Scale)和位移(Translate)...
分类:
移动开发 时间:
2014-06-07 13:46:46
阅读次数:
605
题目链接判断一颗二叉树是否是二叉搜索树(二叉排序树),也就是BST如果该二叉树是BST, 那么对其中序遍历,所得序列一定是单调递增的(不考虑有重复数值的情况)附上代码:
1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 *...
分类:
其他好文 时间:
2014-06-07 11:28:18
阅读次数:
254
打开File Search对话框,选中正则表达式,在搜索文本框输入 /n文件名称输入
*.java在范围里选中Enclosing projects然后就可以统计出整个项目的代码行数。
分类:
系统相关 时间:
2014-06-07 06:16:41
阅读次数:
279
当用JScrollPane和JPanel显示图片时,需要将JPanel的PrefferedSize及时传递给JScrollPane,否则容易出现JScrollPane的滚动条无法与图片大小匹配的问题,下面是从Matrix网上搜到的一段代码供参考使用:import
java.awt.Dimension...
分类:
Web程序 时间:
2014-06-05 17:45:15
阅读次数:
263
题目链接 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? ...
分类:
其他好文 时间:
2014-06-05 16:56:29
阅读次数:
228