Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARTS 第一周(2019.9.16~2019.9.22) #1

Open
caimel opened this issue Sep 24, 2019 · 0 comments
Open

ARTS 第一周(2019.9.16~2019.9.22) #1

caimel opened this issue Sep 24, 2019 · 0 comments

Comments

@caimel
Copy link
Owner

caimel commented Sep 24, 2019

Algorithm 旋转图像

  • 题目:给定一个 n × n 的二维矩阵表示一个图像。将图像顺时针旋转 90 度。
  • 思路:先做转置,再做翻转

/**
 * @param {number[][]} matrix
 * @return {void} Do not return anything, modify matrix in-place instead.
 */
var rotate = function(matrix) {
   var len = matrix.length;
		/***
		 * 先转置
		 */
		for (var i = 0; i < len; i++ ){
            for(var j = i; j < len; j++){
                var temp = matrix[i][j];
                matrix[i][j] = matrix[j][i];
                matrix[j][i] = temp;
            }
        }
        /***
	 * 后翻转
	*/
       for (var i = 0; i < len; i++) {
           for (var j = 0; j < len / 2; j++) {
               var temp = matrix[i][j];
               matrix[i][j] = matrix[i][len - j - 1];
               matrix[i][len - j - 1] = temp;
           }
       }
		return matrix;
};
var a = [
    [1,2,3],
    [4,5,6],
    [7,8,9]
];

		
var v = rotate(a);
		/***
		 * 打印矩阵
		 */
	console.log(v);

Review vue2组件通信-使用dispatch和broadcast

https://juejin.im/entry/5a4df4bd51882566e41669bd

Tip expr-eval的使用

https://github.com/silentmatt/expr-eval

Share vue引用handlebars模板引擎

https://github.com/caimel/vue2Experience/blob/master/vue%20%E5%BC%95%E7%94%A8handlebars%E6%A8%A1%E6%9D%BF%E5%BC%95%E6%93%8E.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant