{"id":22513586,"url":"https://github.com/emahtab/odd-even-linked-list","last_synced_at":"2026-01-30T16:52:19.409Z","repository":{"id":79525700,"uuid":"240339670","full_name":"eMahtab/odd-even-linked-list","owner":"eMahtab","description":"Odd Even Linked List","archived":false,"fork":false,"pushed_at":"2020-04-10T11:34:14.000Z","size":3,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-06T01:05:15.852Z","etag":null,"topics":["leetcode","linked-list","odd-even","problem-solving"],"latest_commit_sha":null,"homepage":null,"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/eMahtab.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,"zenodo":null}},"created_at":"2020-02-13T19:07:16.000Z","updated_at":"2020-04-10T11:34:16.000Z","dependencies_parsed_at":"2023-06-25T20:05:46.311Z","dependency_job_id":null,"html_url":"https://github.com/eMahtab/odd-even-linked-list","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/eMahtab/odd-even-linked-list","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eMahtab%2Fodd-even-linked-list","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eMahtab%2Fodd-even-linked-list/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eMahtab%2Fodd-even-linked-list/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eMahtab%2Fodd-even-linked-list/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eMahtab","download_url":"https://codeload.github.com/eMahtab/odd-even-linked-list/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eMahtab%2Fodd-even-linked-list/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28915938,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T16:37:38.804Z","status":"ssl_error","status_checked_at":"2026-01-30T16:37:37.878Z","response_time":66,"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":["leetcode","linked-list","odd-even","problem-solving"],"created_at":"2024-12-07T03:13:32.987Z","updated_at":"2026-01-30T16:52:19.398Z","avatar_url":"https://github.com/eMahtab.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Odd Even Linked List\n## https://leetcode.com/problems/odd-even-linked-list\n\nGiven a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes.\n\nYou should try to do it in place. The program should run in O(1) space complexity and O(nodes) time complexity.\n```\nExample 1:\n\nInput: 1-\u003e2-\u003e3-\u003e4-\u003e5-\u003eNULL\nOutput: 1-\u003e3-\u003e5-\u003e2-\u003e4-\u003eNULL\n\nExample 2:\n\nInput: 2-\u003e1-\u003e3-\u003e5-\u003e6-\u003e4-\u003e7-\u003eNULL\nOutput: 2-\u003e3-\u003e6-\u003e7-\u003e1-\u003e5-\u003e4-\u003eNULL\n```\n**Note:**\n\n1. The relative order inside both the even and odd groups should remain as it was in the input.\n2. The first node is considered odd, the second node even and so on ...\n\n# Implementation :\n\n```java\n/**\n * Definition for singly-linked list.\n * public class ListNode {\n *     int val;\n *     ListNode next;\n *     ListNode(int x) { val = x; }\n * }\n */\nclass Solution {\n    public ListNode oddEvenList(ListNode head) {\n        if(head == null)\n            return head;\n        ListNode odd = head;\n        ListNode even = head.next;\n        ListNode evenHead = even;\n        while(even != null \u0026\u0026 even.next != null){\n            odd = odd.next = even.next;\n            even = even.next = odd.next;\n        }\n        odd.next = evenHead;\n        return head;\n    }\n}\n```\n\n# References :\nhttps://www.youtube.com/watch?v=bFR0ZvDt-J8\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femahtab%2Fodd-even-linked-list","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femahtab%2Fodd-even-linked-list","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femahtab%2Fodd-even-linked-list/lists"}