{"action":"opened","issue":{"url":"https://api.github.com/repos/GalaxyScape/Article/issues/6","repository_url":"https://api.github.com/repos/GalaxyScape/Article","labels_url":"https://api.github.com/repos/GalaxyScape/Article/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/GalaxyScape/Article/issues/6/comments","events_url":"https://api.github.com/repos/GalaxyScape/Article/issues/6/events","html_url":"https://github.com/GalaxyScape/Article/issues/6","id":330844631,"node_id":"MDU6SXNzdWUzMzA4NDQ2MzE=","number":6,"title":"45. Jump Game II","user":{"login":"GalaxyScape","id":17352051,"node_id":"MDQ6VXNlcjE3MzUyMDUx","avatar_url":"https://avatars2.githubusercontent.com/u/17352051?v=4","gravatar_id":"","url":"https://api.github.com/users/GalaxyScape","html_url":"https://github.com/GalaxyScape","followers_url":"https://api.github.com/users/GalaxyScape/followers","following_url":"https://api.github.com/users/GalaxyScape/following{/other_user}","gists_url":"https://api.github.com/users/GalaxyScape/gists{/gist_id}","starred_url":"https://api.github.com/users/GalaxyScape/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GalaxyScape/subscriptions","organizations_url":"https://api.github.com/users/GalaxyScape/orgs","repos_url":"https://api.github.com/users/GalaxyScape/repos","events_url":"https://api.github.com/users/GalaxyScape/events{/privacy}","received_events_url":"https://api.github.com/users/GalaxyScape/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-09T02:13:58Z","updated_at":"2018-06-09T02:13:58Z","closed_at":null,"author_association":"OWNER","body":"```c\r\nint jump(int* nums, int numsSize) {\r\n\tif (numsSize <= 1)\r\n\t\treturn 0;\r\n\tint step = 0;\r\n\t//跳到\r\n\tint pos = 0;\r\n\tint nextpos = 0;\r\n\tint border = nums[0];\r\n       //初始边界\r\n\twhile (true)\r\n\t{\r\n               //如果边界足够到达最右边 结束 注意此时能够达到 但并没有去执行 所以要加1\r\n\t\tif (border >= numsSize - 1)\r\n\t\t\treturn step+1;\r\n               //扫描下一组能够到达的最边界位置 首先用下一个位置初始化\r\n\t\tint maxExtension = nums[pos + 1] + pos + 1;\r\n\t\tnextpos = pos + 1;\r\n\t\tfor (int i = pos + 2;i <= pos + nums[pos]; ++i)\r\n\t\t{\r\n\t\t\tif(maxExtension < nums[i] + i)\r\n\t\t\t{\r\n\t\t\t\tnextpos = i;\r\n\t\t\t\tmaxExtension = nums[i] + i;\r\n\t\t\t}\r\n\t\t}\r\n               //更新下一个贪心位置 边界值 和 步数\r\n\t\tpos = nextpos;\r\n\t\tborder = nums[pos] + pos;\r\n\t\tstep++;\r\n\r\n\t}\r\n}\r\n```"}}
{"actor":{"display_login":"GalaxyScape"}}