{"id":23684100,"url":"https://github.com/lepharamramchiary/reverse-string--","last_synced_at":"2026-01-06T06:30:18.058Z","repository":{"id":156031558,"uuid":"599012235","full_name":"LepharamRamchiary/Reverse-String--","owner":"LepharamRamchiary","description":null,"archived":false,"fork":false,"pushed_at":"2023-02-08T09:29:31.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-29T20:33:28.769Z","etag":null,"topics":["cpp"],"latest_commit_sha":null,"homepage":"","language":null,"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/LepharamRamchiary.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":"2023-02-08T09:13:37.000Z","updated_at":"2023-05-03T07:34:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"c6c28735-aa9f-4687-98c1-3ab704ce7fed","html_url":"https://github.com/LepharamRamchiary/Reverse-String--","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LepharamRamchiary%2FReverse-String--","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LepharamRamchiary%2FReverse-String--/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LepharamRamchiary%2FReverse-String--/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LepharamRamchiary%2FReverse-String--/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LepharamRamchiary","download_url":"https://codeload.github.com/LepharamRamchiary/Reverse-String--/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239735885,"owners_count":19688356,"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","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":["cpp"],"created_at":"2024-12-29T20:33:18.210Z","updated_at":"2026-01-06T06:30:17.984Z","avatar_url":"https://github.com/LepharamRamchiary.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"**Question is-- Reverse String ||**\n\nGiven a string s and an integer k, reverse the first k characters for every 2k characters counting from the start of the string.\n\nIf there are fewer than k characters left, reverse all of them. If there are less than 2k but greater than or equal to k characters, then reverse the first k characters and leave the other as original.\n\nExample 1-\n```\nInput: s = \"abcdefg\", k = 2\nOutput: \"bacdfeg\"\n```\n\nExample 2-\n```\nInput: s = \"abcd\", k = 2\nOutput: \"bacd\"\n```\n\nSolution:-\n```\n  #include\u003cbits/stdc++.h\u003e\n  using namespace std;\n\n  string rev(string s, int k){\n      int len = s.length();\n      for(int i = 0; i\u003c s.size(); i+=2*k){\n          if(i+k\u003elen){\n             break;\n          }\n          reverse(s.begin()+i, s.begin()+i+k);\n      }\n      return s;\n  }\n\n  int main(){\n      string s;\n      cout\u003c\u003c\"Enter the any char: \";\n      cin\u003e\u003es;\n      int k = 2;\n      cout\u003c\u003crev(s,k);\n      return 0;\n  }\n  ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flepharamramchiary%2Freverse-string--","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flepharamramchiary%2Freverse-string--","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flepharamramchiary%2Freverse-string--/lists"}