美文网首页
8 ARTS打卡第八周(2019-09-17)

8 ARTS打卡第八周(2019-09-17)

作者: 无敌的潘大帅 | 来源:发表于2019-10-04 21:48 被阅读0次

Algorithm

本周算法:48.旋转图像(未解出)
题解思路:使用两次翻转来实现旋转效果,首先第一次翻转,将对应的行数字移动至它旋转后应在的数组中,但是位置并不一定正确,比如7原先在索引为2的数组,通过翻转将它移动至索引为0的数组中。第二次翻转则将每个一维数组进行反转操作,将对应数字移动到正确的位置。

题解代码

class Solution {
    public void rotate(int[][] matrix) {
        int n = matrix.length;
        for (int i = 0; i < n; i ++) {
            for (int j = i; j < n; j++) {
                int temp = matrix[i][j];
                matrix[i][j] = matrix[j][i];
                matrix[j][i] = temp;
            }
        }
        
        for (int i = 0; i < n; i ++) {
           for (int j = 0; j < n / 2; j++) {
            int tmp = matrix[i][j];
            matrix[i][j] = matrix[i][n - j - 1];
            matrix[i][n - j - 1] = tmp;
           }
        }
    }
}

Review

Tip

以下是关于cp命令的使用
cp usage
\cp -rf file1.txt file2.txt
cp前加上\ 在存在相同文件时,进行覆盖而不提示
-r -R Copy directories recursively. 递归复制文件及文件夹
-f If an existing destination file cannot be opened, remove it and try again. This option has no effect if the -n/--no-clobber option is used. However, it applies independently of -i/--interactive; neither option cancels the effect of the other,如果目标文件存在,强制将其删除,并重新执行复制操作。

Share

这是一篇关于FTP服务器安装的过程,我已根据这篇文章成功搭建出对应的FTP服务器。
ftp安装

相关文章

  • 8 ARTS打卡第八周(2019-09-17)

    Algorithm 本周算法:48.旋转图像(未解出)题解思路:使用两次翻转来实现旋转效果,首先第一次翻转,将对应...

  • ARTS打卡第八周

    ARTS打卡第八周 Algorithm:每周至少做一个 leetcode 的算法题 1689. 十-二进制数的最少...

  • ARTS第八周

    Algorithm shortest-palindrome给定一个字符串s,在s前增加最少字符串使得回文还是上一周...

  • ARTS 第8周

    ARTS 第8周分享 [TOC] Algorithm 八皇后问题 在 8 X 8 的网格中,放入八个皇后(棋子),...

  • ARTS打卡,第二周

    每周完成一个ARTS:1.A(Algorithm)每周至少做一个 leetcode 的算法题2.R(Review)...

  • ARTS打卡 第2周

    打卡日期 2019-07-22 至 2019-07-28Algorithm:1115. 交替打印FooBarhtt...

  • ARTS打卡,第五周

    每周完成一个ARTS:1.A(Algorithm)每周至少做一个 leetcode 的算法题2.R(Review)...

  • ARTS打卡 第3周

    打卡日期 2019-07-29 至 2019-08-04Algorithm:58. 最后一个单词的长度https:...

  • ARTS打卡 第4周

    打卡日期 2019-08-05 至 2019-08-11Algorithm:58. 最后一个单词的长度https:...

  • ARTS打卡第五周

    Tip: Algorithm: Share: Disruptor介绍及原理讲解 Review: dissectin...

网友评论

      本文标题:8 ARTS打卡第八周(2019-09-17)

      本文链接:https://www.haomeiwen.com/subject/pxccuctx.html