{"id":18071808,"url":"https://github.com/ygit/algorithms","last_synced_at":"2026-02-06T17:31:01.296Z","repository":{"id":84012822,"uuid":"338621540","full_name":"ygit/algorithms","owner":"ygit","description":null,"archived":false,"fork":false,"pushed_at":"2021-02-14T13:27:55.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-04T18:47:31.192Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ygit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-02-13T16:51:09.000Z","updated_at":"2021-02-14T13:27:57.000Z","dependencies_parsed_at":"2023-03-12T20:40:09.533Z","dependency_job_id":null,"html_url":"https://github.com/ygit/algorithms","commit_stats":{"total_commits":3,"total_committers":1,"mean_commits":3.0,"dds":0.0,"last_synced_commit":"6dab45e4a6e7dcfcc982abfcfeb5e336ae117c74"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ygit/algorithms","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ygit%2Falgorithms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ygit%2Falgorithms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ygit%2Falgorithms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ygit%2Falgorithms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ygit","download_url":"https://codeload.github.com/ygit/algorithms/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ygit%2Falgorithms/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29170053,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-06T16:33:35.550Z","status":"ssl_error","status_checked_at":"2026-02-06T16:33:30.716Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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-10-31T09:17:05.078Z","updated_at":"2026-02-06T17:31:01.277Z","avatar_url":"https://github.com/ygit.png","language":null,"readme":"# Algorithms\n\n1. Maximum Pairwise Product\nGiven a sequence of n non-negative integers to find the maximum pairwise product.\nInput: [1,2,3] \nOutput: 6\nInput: [5,6,7]\nOutput: 42\n\nSolution - \n\n    func maximumPairwiseProduct(array: [Int]) -\u003e Int? {\n    \n      guard var maxProduct = array.first else {\n          return nil\n      }\n    \n      for (index, number) in array.enumerated() {\n        \n        var anotherIndex = index + 1\n        \n        while anotherIndex \u003c array.count {\n            \n            let anotherNumber = array[anotherIndex]\n            \n            let product = number * anotherNumber\n            \n            if product \u003e maxProduct {\n                maxProduct = product\n            }\n            \n            anotherIndex += 1\n        }\n        \n      }\n    \n      return maxProduct\n    }\n\n    maximumPairwiseProduct(array: [5,6,7]) =\u003e 42\n    \n    \n    \n2. Get largest number from string\nInput: 132\nOutput: 321\nInput: 123456789\nOutput: 987654321\n\nSolution - \n\n    func getLargestNumber(_ string: String) -\u003e String {\n\n        guard string.count \u003e 0 else {\n            return \"\"\n        }\n\n        var array = string.compactMap { Int(String($0)) }\n\n        var largestNumber = array.first!\n        var largestNumberIndex = 0\n\n        for (index, number) in array.enumerated() {\n\n            if number \u003e largestNumber {\n                largestNumber = number\n                largestNumberIndex = index\n            }\n        }\n\n        array.remove(at: largestNumberIndex)\n\n        let newArray = array.map { String($0) }\n\n        let newString = newArray.joined()\n\n        print(largestNumberIndex, largestNumber, newString)\n\n        return \"\\(largestNumber)\" + getLargestNumber(newString)\n    }\n\n    getLargestNumber(\"19848301023\")\n    getLargestNumber(\"1234567890\")\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fygit%2Falgorithms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fygit%2Falgorithms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fygit%2Falgorithms/lists"}