{"id":215776,"date":"2020-11-16T17:49:18","date_gmt":"2020-11-16T09:49:18","guid":{"rendered":"http:\/\/4563.org\/?p=215776"},"modified":"2020-11-16T17:49:18","modified_gmt":"2020-11-16T09:49:18","slug":"facebook-%e5%8f%88%e8%80%83%e5%8e%9f%e9%a2%98%ef%bc%8c%e5%ae%83%e7%9a%84%e9%a2%98%e5%ba%93%e5%88%b0%e5%ba%95%e6%9c%89%e5%a4%9a%e5%b0%91%e3%80%82%e3%80%82","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=215776","title":{"rendered":"Facebook \u53c8\u8003\u539f\u9898\uff0c\u5b83\u7684\u9898\u5e93\u5230\u5e95\u6709\u591a\u5c11\u3002\u3002"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  Facebook \u53c8\u8003\u539f\u9898\uff0c\u5b83\u7684\u9898\u5e93\u5230\u5e95\u6709\u591a\u5c11\u3002\u3002               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : zzzrf <\/span>  <span><i><\/i> 3<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u4e4b\u524d\u542c\u8bf4 FB \u8003\u8fc7 2 \u9053 hard \u9898\uff0c\u8fd8\u53ea\u7ed9 40 \u5206\u949f\u7684\u2026\u2026<\/p>\n<p>FB \u6709\u65f6\u5019\u5c31\u662f\u903c\u4f60\u80cc\u7b54\u6848\uff0c\u73b0\u5728\u60f3\u60f3\u4e5f\u6709\u9053\u7406\uff0c\u613f\u610f\u5237\u9898\u4e5f\u80fd\u770b\u51fa\u5de5\u4f5c\u6001\u5ea6\uff0c\u4e0d\u8fc7\u56fd\u5185\u5927\u5382\u5e94\u8be5\u5f88\u96be\u201c\u4ec5\u201d\u9760\u5237\u9898\u4e0a\u5cb8\u5427\uff1f<\/p>\n<p>\u7ed9\u5b9a\u4e24\u4e2a \u7a00\u758f\u77e9\u9635 A \u548c B\uff0c\u8fd4\u56de AB \u7684\u7ed3\u679c\u3002 \u60a8\u53ef\u4ee5\u5047\u8bbe A \u7684\u5217\u6570\u7b49\u4e8e B \u7684\u884c\u6570\u3002<\/p>\n<p>\u9898\u76ee\u94fe\u63a5<\/p>\n<h2>\u6837\u4f8b 1<\/h2>\n<pre><code>Input:  [[1,0,0],[-1,0,3]] [[7,0,0],[0,0,0],[0,0,1]] Output: [[7,0,0],[-7,0,3]] Explanation: A = [   [ 1, 0, 0],   [-1, 0, 3] ]  B = [   [ 7, 0, 0 ],   [ 0, 0, 0 ],   [ 0, 0, 1 ] ]        |  1 0 0 |   | 7 0 0 |   |  7 0 0 | AB = | -1 0 3 | x | 0 0 0 | = | -7 0 3 |                   | 0 0 1 | <\/code><\/pre>\n<h2>\u6837\u4f8b 2<\/h2>\n<pre><code>Input: [[1,0],[0,1]] [[0,1],[1,0]] Output: [[0,1],[1,0]] <\/code><\/pre>\n<h2>\u7b97\u6cd5\uff1a\u6a21\u62df<\/h2>\n<h3>\u601d\u8def<\/h3>\n<p>\u77e9\u9635\u4e58\u6cd5\u7684\u5b9e\u73b0\uff1a\u4e00\u4e2a m \u884c n \u5217\u7684\u77e9\u9635 A\uff0c\u4e0e\u4e00\u4e2a n \u884c p \u5217\u7684\u77e9\u9635 B \u53ef\u4ee5\u76f8\u4e58\uff0c\u5f97\u5230\u7684\u7ed3\u679c AB \u662f\u4e00\u4e2a m \u884c p \u5217\u7684\u77e9\u9635\uff0c\u5176\u4e2d\u7684\u7b2c i \u884c\u7b2c j \u5217\u4f4d\u7f6e\u4e0a\u7684\u6570 AB(i,j)\u4e3a\uff0c\u77e9\u9635 A \u7b2c i \u884c\u4e0a\u7684 n \u4e2a\u6570\u4e0e\u77e9\u9635 B \u7b2c j \u5217\u4e0a\u7684 n \u4e2a\u6570\u4e00\u4e00\u5bf9\u5e94\u76f8\u4e58\u540e\uff0c\u6240\u5f97\u5230\u7684 n \u4e2a\u4e58\u79ef\u4e4b\u548c\u3002\u76f4\u63a5\u6a21\u62df\u5373\u53ef\u3002<\/p>\n<h2>\u590d\u6742\u5ea6\u5206\u6790<\/h2>\n<p>\u7a7a\u95f4\u590d\u6742\u5ea6 O(n^2) \u65f6\u95f4\u590d\u6742\u5ea6 O(n^3)<\/p>\n<pre><code>public class Solution {     \/**      * @param A: a sparse matrix      * @param B: a sparse matrix      * @return: the result of A * B      *\/     public int[][] multiply(int[][] A, int[][] B) {         int rowA = A.length, columnA = A[0].length;         int rowB = B.length, columnB = B[0].length;         \/\/ AB \u4e3a rowA * columnB \u5927\u5c0f\u7684\u77e9\u9635         int[][] AB = new int [rowA][columnB];         for (int i = 0; i &lt; rowA; i++){             for (int j = 0; j &lt; columnB; j++){                 \/\/ \u6c42\u51fa\u6bcf\u4e00\u9879                 int sum = 0;                 for (int k = 0; k &lt; columnA; k++){                     sum += A[i][k] * B[k][j];                 }                 AB[i][j] = sum;             }         }         return AB;     } }  <\/code><\/pre>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>0<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>Facebook \u53c8\u8003\u539f\u9898\uff0c\u5b83\u7684\u9898&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/215776"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=215776"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/215776\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=215776"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=215776"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=215776"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}