{"action":"created","issue":{"url":"https://api.github.com/repos/SHU-2016-SummerPractice/AlgorithmExerciseIssues/issues/17","repository_url":"https://api.github.com/repos/SHU-2016-SummerPractice/AlgorithmExerciseIssues","labels_url":"https://api.github.com/repos/SHU-2016-SummerPractice/AlgorithmExerciseIssues/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/SHU-2016-SummerPractice/AlgorithmExerciseIssues/issues/17/comments","events_url":"https://api.github.com/repos/SHU-2016-SummerPractice/AlgorithmExerciseIssues/issues/17/events","html_url":"https://github.com/SHU-2016-SummerPractice/AlgorithmExerciseIssues/issues/17","id":167751065,"number":17,"title":"字符串&数组 2016-7-27","user":{"login":"dayang","id":8947043,"avatar_url":"https://avatars.githubusercontent.com/u/8947043?v=3","gravatar_id":"","url":"https://api.github.com/users/dayang","html_url":"https://github.com/dayang","followers_url":"https://api.github.com/users/dayang/followers","following_url":"https://api.github.com/users/dayang/following{/other_user}","gists_url":"https://api.github.com/users/dayang/gists{/gist_id}","starred_url":"https://api.github.com/users/dayang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dayang/subscriptions","organizations_url":"https://api.github.com/users/dayang/orgs","repos_url":"https://api.github.com/users/dayang/repos","events_url":"https://api.github.com/users/dayang/events{/privacy}","received_events_url":"https://api.github.com/users/dayang/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-07-27T01:50:24Z","updated_at":"2016-07-27T07:28:27Z","closed_at":null,"body":"43  [Multiply Strings](https://leetcode.com/problems/multiply-strings/)\r\n15  [3Sum](https://leetcode.com/problems/3sum/)"},"comment":{"url":"https://api.github.com/repos/SHU-2016-SummerPractice/AlgorithmExerciseIssues/issues/comments/235507859","html_url":"https://github.com/SHU-2016-SummerPractice/AlgorithmExerciseIssues/issues/17#issuecomment-235507859","issue_url":"https://api.github.com/repos/SHU-2016-SummerPractice/AlgorithmExerciseIssues/issues/17","id":235507859,"user":{"login":"wolfogre","id":9418365,"avatar_url":"https://avatars.githubusercontent.com/u/9418365?v=3","gravatar_id":"","url":"https://api.github.com/users/wolfogre","html_url":"https://github.com/wolfogre","followers_url":"https://api.github.com/users/wolfogre/followers","following_url":"https://api.github.com/users/wolfogre/following{/other_user}","gists_url":"https://api.github.com/users/wolfogre/gists{/gist_id}","starred_url":"https://api.github.com/users/wolfogre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wolfogre/subscriptions","organizations_url":"https://api.github.com/users/wolfogre/orgs","repos_url":"https://api.github.com/users/wolfogre/repos","events_url":"https://api.github.com/users/wolfogre/events{/privacy}","received_events_url":"https://api.github.com/users/wolfogre/received_events","type":"User","site_admin":false},"created_at":"2016-07-27T07:28:27Z","updated_at":"2016-07-27T07:28:27Z","body":"43 Multiply Strings，超时，我得优化一下\r\n```java\r\npublic class Solution {\r\n\r\n    public String multiply(String num1, String num2) {\r\n        return mul(new StringBuilder(num1).reverse().toString(), new StringBuilder(num2).reverse().toString()).reverse().toString();\r\n    }\r\n    \r\n    private StringBuilder mul(String a, String b)\r\n    {\r\n\t    StringBuilder result = new StringBuilder();\r\n\t    for(int i = 0; i < a.length(); ++i)\r\n\t\t    for (int j = 0; j < b.length(); ++j)\r\n\t\t    {\r\n\t\t\t    StringBuilder temp = make((a.charAt(i) - '0') * (b.charAt(j) - '0'), i + j);\r\n\t\t\t    result = add(result, temp);\r\n\t\t    }\r\n\t    return result;\r\n    }\r\n\r\n    private StringBuilder make(Integer num, int zero_num)\r\n    {\r\n    \tStringBuilder result = new StringBuilder();\r\n    \twhile (zero_num-- > 0)\r\n    \t\tresult.append(\"0\");\r\n    \tresult.append(new StringBuilder().append(num).reverse());\r\n    \treturn result;\r\n    }\r\n    \r\n    private StringBuilder add(StringBuilder a, int a_zero_num, StringBuilder b, int b_zero_num,)\r\n    {\r\n    \tStringBuilder result = new StringBuilder();\r\n    \tint carry = 0;\r\n    \tfor(int i = 0; i < a.length() || i < b.length() || carry != 0; ++i)\r\n    \t{\r\n    \t\tInteger sum = (i < a.length() ? (a.charAt(i) - '0') : 0) + (i < b.length() ? (b.charAt(i) - '0') : 0) + carry;\r\n    \t\tcarry = sum / 10;\r\n    \t\tsum %= 10;\r\n    \t\tresult.append(sum);\r\n    \t}\r\n    \twhile(result.length() > 1 && result.charAt(result.length() - 1) == '0'){\r\n    \t    result.deleteCharAt(result.length() - 1);\r\n    \t}\r\n    \treturn result;\r\n    }\r\n}\r\n```"}}
{"actor":{"display_login":"wolfogre"}}