{"action":"created","comment":{"url":"https://api.github.com/repos/Voudy/code_guide/pulls/comments/183229401","pull_request_review_id":114193655,"id":183229401,"diff_hunk":"@@ -0,0 +1,136 @@\n+package homework01\n+\n+fun binarySearch(array: List<Int>, f: Int): Int {\n+    var begin: Int = 0;\n+    var end: Int = array.size - 1\n+    var i: Int = (begin + end) / 2\n+    while (begin <= end && array[i] != f) {\n+        if (array[i] > f) {\n+            end = i - 1\n+            i = (begin + end) / 2\n+        } else if (array[i] < f) {\n+            begin = i + 1\n+            i = (begin + end) / 2\n+        }\n+    }\n+    if (array[i] != f) {\n+        return -1\n+    } else {\n+        return i\n+    }\n+}\n+\n+fun binarySearch2(array: List<Int>, f: Int): Float {\n+    var begin: Int = 0;\n+    var end: Int = array.size - 1\n+    var i: Int = (begin + end) / 2\n+    while (begin <= end && array[i] != f) {\n+        if (array[i] > f) {\n+            end = i - 1\n+            i = (begin + end) / 2\n+        } else if (array[i] < f) {\n+            begin = i + 1\n+            i = (begin + end) / 2\n+        }\n+    }\n+\n+    if (array[i] != f) {\n+        return (begin + end.toFloat()) / 2\n+    } else {\n+        return i.toFloat()\n+    }\n+}\n+\n+fun howManyNumbers(array: List<Int>, l: Int, r: Int): Int {\n+    array.toIntArray().sort()\n+    var left: Float = binarySearch2(array, l);\n+    var right: Float = binarySearch2(array, r);\n+    if (left > left.toInt().toFloat()) {\n+        return right.toInt() - left.toInt()\n+    } else {\n+        return right.toInt() - left.toInt() + 1\n+    }\n+}\n+\n+\n+fun getSumOfPrime(k: Int): Long {\n+    val array = Array(10001, { i -> 0 })\n+    for (i in 2..array.size - 1 step 1) {\n+        if (array[i] == 0) {\n+            for (j in 2 * i..array.size - 1 step i) {\n+                array[j] = 1\n+            }\n+        }\n+    }\n+    var s: Long = 0\n+    var i: Int = 0\n+    var j: Int = 2\n+    while (i != k && j < array.size) {\n+        if (array[j] == 0) {\n+            println(j)\n+            s += j\n+            i++\n+        }\n+        j++\n+    }","path":"src/homework01/Tasks.kt","position":75,"original_position":75,"commit_id":"0cf54cd2a76bde763fdd58110791021a05c20ec4","original_commit_id":"0cf54cd2a76bde763fdd58110791021a05c20ec4","user":{"login":"ImmortalTurtle","id":22173703,"avatar_url":"https://avatars0.githubusercontent.com/u/22173703?v=4","gravatar_id":"","url":"https://api.github.com/users/ImmortalTurtle","html_url":"https://github.com/ImmortalTurtle","followers_url":"https://api.github.com/users/ImmortalTurtle/followers","following_url":"https://api.github.com/users/ImmortalTurtle/following{/other_user}","gists_url":"https://api.github.com/users/ImmortalTurtle/gists{/gist_id}","starred_url":"https://api.github.com/users/ImmortalTurtle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ImmortalTurtle/subscriptions","organizations_url":"https://api.github.com/users/ImmortalTurtle/orgs","repos_url":"https://api.github.com/users/ImmortalTurtle/repos","events_url":"https://api.github.com/users/ImmortalTurtle/events{/privacy}","received_events_url":"https://api.github.com/users/ImmortalTurtle/received_events","type":"User","site_admin":false},"body":"Что за `s`, `i`, `j`? Назвал бы хотя бы `sum`, `primesCount`, `index`\r\nПочему `while`, а не `for`? Тяжелее понимается и переменная еще добавочная\r\n\r\nКотлин, к слову, позволяет написать то же самое одной строчкой:\r\n`(2 until array.size).filter {array[it] == 0}.take(k).sum()`","created_at":"2018-04-22T08:37:41Z","updated_at":"2018-04-22T08:37:42Z","html_url":"https://github.com/Voudy/code_guide/pull/14#discussion_r183229401","pull_request_url":"https://api.github.com/repos/Voudy/code_guide/pulls/14","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/Voudy/code_guide/pulls/comments/183229401"},"html":{"href":"https://github.com/Voudy/code_guide/pull/14#discussion_r183229401"},"pull_request":{"href":"https://api.github.com/repos/Voudy/code_guide/pulls/14"}}},"pull_request":{"url":"https://api.github.com/repos/Voudy/code_guide/pulls/14","id":181446822,"html_url":"https://github.com/Voudy/code_guide/pull/14","diff_url":"https://github.com/Voudy/code_guide/pull/14.diff","patch_url":"https://github.com/Voudy/code_guide/pull/14.patch","issue_url":"https://api.github.com/repos/Voudy/code_guide/issues/14","number":14,"state":"open","locked":false,"title":"FPR","user":{"login":"ilyazavadskij","id":31802293,"avatar_url":"https://avatars0.githubusercontent.com/u/31802293?v=4","gravatar_id":"","url":"https://api.github.com/users/ilyazavadskij","html_url":"https://github.com/ilyazavadskij","followers_url":"https://api.github.com/users/ilyazavadskij/followers","following_url":"https://api.github.com/users/ilyazavadskij/following{/other_user}","gists_url":"https://api.github.com/users/ilyazavadskij/gists{/gist_id}","starred_url":"https://api.github.com/users/ilyazavadskij/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ilyazavadskij/subscriptions","organizations_url":"https://api.github.com/users/ilyazavadskij/orgs","repos_url":"https://api.github.com/users/ilyazavadskij/repos","events_url":"https://api.github.com/users/ilyazavadskij/events{/privacy}","received_events_url":"https://api.github.com/users/ilyazavadskij/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-04-13T10:24:10Z","updated_at":"2018-04-22T08:37:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c21eb9fb7405cf238379e8a21e6ddfac15426f7f","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":881490961,"url":"https://api.github.com/repos/Voudy/code_guide/labels/needs%20work","name":"needs work","color":"ffcc00","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/Voudy/code_guide/pulls/14/commits","review_comments_url":"https://api.github.com/repos/Voudy/code_guide/pulls/14/comments","review_comment_url":"https://api.github.com/repos/Voudy/code_guide/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Voudy/code_guide/issues/14/comments","statuses_url":"https://api.github.com/repos/Voudy/code_guide/statuses/0cf54cd2a76bde763fdd58110791021a05c20ec4","head":{"label":"ilyazavadskij:master","ref":"master","sha":"0cf54cd2a76bde763fdd58110791021a05c20ec4","user":{"login":"ilyazavadskij","id":31802293,"avatar_url":"https://avatars0.githubusercontent.com/u/31802293?v=4","gravatar_id":"","url":"https://api.github.com/users/ilyazavadskij","html_url":"https://github.com/ilyazavadskij","followers_url":"https://api.github.com/users/ilyazavadskij/followers","following_url":"https://api.github.com/users/ilyazavadskij/following{/other_user}","gists_url":"https://api.github.com/users/ilyazavadskij/gists{/gist_id}","starred_url":"https://api.github.com/users/ilyazavadskij/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ilyazavadskij/subscriptions","organizations_url":"https://api.github.com/users/ilyazavadskij/orgs","repos_url":"https://api.github.com/users/ilyazavadskij/repos","events_url":"https://api.github.com/users/ilyazavadskij/events{/privacy}","received_events_url":"https://api.github.com/users/ilyazavadskij/received_events","type":"User","site_admin":false},"repo":{"id":127163516,"name":"code_guide","full_name":"ilyazavadskij/code_guide","owner":{"login":"ilyazavadskij","id":31802293,"avatar_url":"https://avatars0.githubusercontent.com/u/31802293?v=4","gravatar_id":"","url":"https://api.github.com/users/ilyazavadskij","html_url":"https://github.com/ilyazavadskij","followers_url":"https://api.github.com/users/ilyazavadskij/followers","following_url":"https://api.github.com/users/ilyazavadskij/following{/other_user}","gists_url":"https://api.github.com/users/ilyazavadskij/gists{/gist_id}","starred_url":"https://api.github.com/users/ilyazavadskij/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ilyazavadskij/subscriptions","organizations_url":"https://api.github.com/users/ilyazavadskij/orgs","repos_url":"https://api.github.com/users/ilyazavadskij/repos","events_url":"https://api.github.com/users/ilyazavadskij/events{/privacy}","received_events_url":"https://api.github.com/users/ilyazavadskij/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ilyazavadskij/code_guide","description":"code_guide lectures","fork":true,"url":"https://api.github.com/repos/ilyazavadskij/code_guide","forks_url":"https://api.github.com/repos/ilyazavadskij/code_guide/forks","keys_url":"https://api.github.com/repos/ilyazavadskij/code_guide/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ilyazavadskij/code_guide/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ilyazavadskij/code_guide/teams","hooks_url":"https://api.github.com/repos/ilyazavadskij/code_guide/hooks","issue_events_url":"https://api.github.com/repos/ilyazavadskij/code_guide/issues/events{/number}","events_url":"https://api.github.com/repos/ilyazavadskij/code_guide/events","assignees_url":"https://api.github.com/repos/ilyazavadskij/code_guide/assignees{/user}","branches_url":"https://api.github.com/repos/ilyazavadskij/code_guide/branches{/branch}","tags_url":"https://api.github.com/repos/ilyazavadskij/code_guide/tags","blobs_url":"https://api.github.com/repos/ilyazavadskij/code_guide/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ilyazavadskij/code_guide/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ilyazavadskij/code_guide/git/refs{/sha}","trees_url":"https://api.github.com/repos/ilyazavadskij/code_guide/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ilyazavadskij/code_guide/statuses/{sha}","languages_url":"https://api.github.com/repos/ilyazavadskij/code_guide/languages","stargazers_url":"https://api.github.com/repos/ilyazavadskij/code_guide/stargazers","contributors_url":"https://api.github.com/repos/ilyazavadskij/code_guide/contributors","subscribers_url":"https://api.github.com/repos/ilyazavadskij/code_guide/subscribers","subscription_url":"https://api.github.com/repos/ilyazavadskij/code_guide/subscription","commits_url":"https://api.github.com/repos/ilyazavadskij/code_guide/commits{/sha}","git_commits_url":"https://api.github.com/repos/ilyazavadskij/code_guide/git/commits{/sha}","comments_url":"https://api.github.com/repos/ilyazavadskij/code_guide/comments{/number}","issue_comment_url":"https://api.github.com/repos/ilyazavadskij/code_guide/issues/comments{/number}","contents_url":"https://api.github.com/repos/ilyazavadskij/code_guide/contents/{+path}","compare_url":"https://api.github.com/repos/ilyazavadskij/code_guide/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ilyazavadskij/code_guide/merges","archive_url":"https://api.github.com/repos/ilyazavadskij/code_guide/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ilyazavadskij/code_guide/downloads","issues_url":"https://api.github.com/repos/ilyazavadskij/code_guide/issues{/number}","pulls_url":"https://api.github.com/repos/ilyazavadskij/code_guide/pulls{/number}","milestones_url":"https://api.github.com/repos/ilyazavadskij/code_guide/milestones{/number}","notifications_url":"https://api.github.com/repos/ilyazavadskij/code_guide/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ilyazavadskij/code_guide/labels{/name}","releases_url":"https://api.github.com/repos/ilyazavadskij/code_guide/releases{/id}","deployments_url":"https://api.github.com/repos/ilyazavadskij/code_guide/deployments","created_at":"2018-03-28T15:47:51Z","updated_at":"2018-04-18T20:44:02Z","pushed_at":"2018-04-18T20:43:59Z","git_url":"git://github.com/ilyazavadskij/code_guide.git","ssh_url":"git@github.com:ilyazavadskij/code_guide.git","clone_url":"https://github.com/ilyazavadskij/code_guide.git","svn_url":"https://github.com/ilyazavadskij/code_guide","homepage":null,"size":65,"stargazers_count":0,"watchers_count":0,"language":"Kotlin","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Voudy:master","ref":"master","sha":"24f11be885944524d43b4c6fbfd4efb35594258a","user":{"login":"Voudy","id":22539802,"avatar_url":"https://avatars3.githubusercontent.com/u/22539802?v=4","gravatar_id":"","url":"https://api.github.com/users/Voudy","html_url":"https://github.com/Voudy","followers_url":"https://api.github.com/users/Voudy/followers","following_url":"https://api.github.com/users/Voudy/following{/other_user}","gists_url":"https://api.github.com/users/Voudy/gists{/gist_id}","starred_url":"https://api.github.com/users/Voudy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Voudy/subscriptions","organizations_url":"https://api.github.com/users/Voudy/orgs","repos_url":"https://api.github.com/users/Voudy/repos","events_url":"https://api.github.com/users/Voudy/events{/privacy}","received_events_url":"https://api.github.com/users/Voudy/received_events","type":"User","site_admin":false},"repo":{"id":126342010,"name":"code_guide","full_name":"Voudy/code_guide","owner":{"login":"Voudy","id":22539802,"avatar_url":"https://avatars3.githubusercontent.com/u/22539802?v=4","gravatar_id":"","url":"https://api.github.com/users/Voudy","html_url":"https://github.com/Voudy","followers_url":"https://api.github.com/users/Voudy/followers","following_url":"https://api.github.com/users/Voudy/following{/other_user}","gists_url":"https://api.github.com/users/Voudy/gists{/gist_id}","starred_url":"https://api.github.com/users/Voudy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Voudy/subscriptions","organizations_url":"https://api.github.com/users/Voudy/orgs","repos_url":"https://api.github.com/users/Voudy/repos","events_url":"https://api.github.com/users/Voudy/events{/privacy}","received_events_url":"https://api.github.com/users/Voudy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Voudy/code_guide","description":"code_guide lectures","fork":false,"url":"https://api.github.com/repos/Voudy/code_guide","forks_url":"https://api.github.com/repos/Voudy/code_guide/forks","keys_url":"https://api.github.com/repos/Voudy/code_guide/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Voudy/code_guide/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Voudy/code_guide/teams","hooks_url":"https://api.github.com/repos/Voudy/code_guide/hooks","issue_events_url":"https://api.github.com/repos/Voudy/code_guide/issues/events{/number}","events_url":"https://api.github.com/repos/Voudy/code_guide/events","assignees_url":"https://api.github.com/repos/Voudy/code_guide/assignees{/user}","branches_url":"https://api.github.com/repos/Voudy/code_guide/branches{/branch}","tags_url":"https://api.github.com/repos/Voudy/code_guide/tags","blobs_url":"https://api.github.com/repos/Voudy/code_guide/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Voudy/code_guide/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Voudy/code_guide/git/refs{/sha}","trees_url":"https://api.github.com/repos/Voudy/code_guide/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Voudy/code_guide/statuses/{sha}","languages_url":"https://api.github.com/repos/Voudy/code_guide/languages","stargazers_url":"https://api.github.com/repos/Voudy/code_guide/stargazers","contributors_url":"https://api.github.com/repos/Voudy/code_guide/contributors","subscribers_url":"https://api.github.com/repos/Voudy/code_guide/subscribers","subscription_url":"https://api.github.com/repos/Voudy/code_guide/subscription","commits_url":"https://api.github.com/repos/Voudy/code_guide/commits{/sha}","git_commits_url":"https://api.github.com/repos/Voudy/code_guide/git/commits{/sha}","comments_url":"https://api.github.com/repos/Voudy/code_guide/comments{/number}","issue_comment_url":"https://api.github.com/repos/Voudy/code_guide/issues/comments{/number}","contents_url":"https://api.github.com/repos/Voudy/code_guide/contents/{+path}","compare_url":"https://api.github.com/repos/Voudy/code_guide/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Voudy/code_guide/merges","archive_url":"https://api.github.com/repos/Voudy/code_guide/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Voudy/code_guide/downloads","issues_url":"https://api.github.com/repos/Voudy/code_guide/issues{/number}","pulls_url":"https://api.github.com/repos/Voudy/code_guide/pulls{/number}","milestones_url":"https://api.github.com/repos/Voudy/code_guide/milestones{/number}","notifications_url":"https://api.github.com/repos/Voudy/code_guide/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Voudy/code_guide/labels{/name}","releases_url":"https://api.github.com/repos/Voudy/code_guide/releases{/id}","deployments_url":"https://api.github.com/repos/Voudy/code_guide/deployments","created_at":"2018-03-22T13:47:42Z","updated_at":"2018-04-18T19:46:13Z","pushed_at":"2018-04-19T07:46:57Z","git_url":"git://github.com/Voudy/code_guide.git","ssh_url":"git@github.com:Voudy/code_guide.git","clone_url":"https://github.com/Voudy/code_guide.git","svn_url":"https://github.com/Voudy/code_guide","homepage":null,"size":45,"stargazers_count":3,"watchers_count":3,"language":"Kotlin","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"archived":false,"open_issues_count":4,"license":null,"forks":11,"open_issues":4,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Voudy/code_guide/pulls/14"},"html":{"href":"https://github.com/Voudy/code_guide/pull/14"},"issue":{"href":"https://api.github.com/repos/Voudy/code_guide/issues/14"},"comments":{"href":"https://api.github.com/repos/Voudy/code_guide/issues/14/comments"},"review_comments":{"href":"https://api.github.com/repos/Voudy/code_guide/pulls/14/comments"},"review_comment":{"href":"https://api.github.com/repos/Voudy/code_guide/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Voudy/code_guide/pulls/14/commits"},"statuses":{"href":"https://api.github.com/repos/Voudy/code_guide/statuses/0cf54cd2a76bde763fdd58110791021a05c20ec4"}},"author_association":"NONE"}}
{"actor":{"display_login":"ImmortalTurtle"}}