{"id":19549259,"url":"https://github.com/timursaurus/dar-intern-task","last_synced_at":"2025-10-18T14:31:59.777Z","repository":{"id":127476462,"uuid":"456953934","full_name":"timursaurus/dar-intern-task","owner":"timursaurus","description":"Dar internship submission  ","archived":false,"fork":false,"pushed_at":"2022-02-08T14:20:16.000Z","size":1,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-06T23:43:58.275Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/timursaurus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-08T13:55:01.000Z","updated_at":"2023-03-07T07:31:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"a7c03528-089b-4296-b860-b98f610e9592","html_url":"https://github.com/timursaurus/dar-intern-task","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/timursaurus/dar-intern-task","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timursaurus%2Fdar-intern-task","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timursaurus%2Fdar-intern-task/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timursaurus%2Fdar-intern-task/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timursaurus%2Fdar-intern-task/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timursaurus","download_url":"https://codeload.github.com/timursaurus/dar-intern-task/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timursaurus%2Fdar-intern-task/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278740839,"owners_count":26037481,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T03:59:31.308Z","updated_at":"2025-10-07T08:08:48.220Z","avatar_url":"https://github.com/timursaurus.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dar internship task\n---\n## First\n\n```ts\nfunction colorPatternTimes(colors: string[]): number {\n  const res = [colors[0]]\n  return colors.forEach(color =\u003e res[res.length - 1] !== color \u0026\u0026 res.push(color)), res.length - 1 + colors.length * 2\n}\n```\n\n```ts\nconsole.log(colorPatternTimes([\"Blue\"])) //=\u003e 2\nconsole.log(colorPatternTimes([\"Red\", \"Yellow\", \"Green\", \"Blue\"])) //=\u003e 11\nconsole.log(colorPatternTimes([\"Blue\", \"Blue\", \"Blue\", \"Red\", \"Red\", \"Red\"])) //=\u003e 13\n\n```\n---\n\n\n## Second\n\n```ts\nfunction plant(seed: string, water: number, fert: number, temp: number): string {\n  const stem = '-'.repeat(water)\n  const flower = seed.repeat(fert)\n  return temp \u003c 20 || temp \u003e 30 ? stem.repeat(water) + seed : (stem + flower).repeat(water)\n}\n```\n\n```ts\nconsole.log(plant(\"@\", 3, 3, 25)) //=\u003e ---@@@---@@@---@@@\nconsole.log(plant(\"#\", 1, 5, 30)) //=\u003e -#####\nconsole.log(plant(\"§\", 3, 3, 15)) //=\u003e ---------§\nconsole.log(plant(\"\u0026\", 5, 1, 20)) //=\u003e -----\u0026-----\u0026-----\u0026-----\u0026-----\u0026\n\n```\n---\n### More readable version of the first solution\n```ts\nfunction colorPatternTimes(colors: string[]): number {\n  const res = [colors[0]]\n  colors.forEach(color =\u003e {\n    if (res[res.length - 1] !== color) {\n      res.push(color)\n    }\n  })\n  return res.length - 1 + colors.length * 2\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimursaurus%2Fdar-intern-task","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimursaurus%2Fdar-intern-task","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimursaurus%2Fdar-intern-task/lists"}