{"id":22513934,"url":"https://github.com/emahtab/delete-node-in-a-linked-list","last_synced_at":"2026-02-15T03:31:18.627Z","repository":{"id":79525401,"uuid":"256295226","full_name":"eMahtab/delete-node-in-a-linked-list","owner":"eMahtab","description":"Delete node in a linked list","archived":false,"fork":false,"pushed_at":"2020-06-04T07:21:23.000Z","size":4,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-07T14:41:17.262Z","etag":null,"topics":["leetcode","linked-list","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}},"created_at":"2020-04-16T18:19:33.000Z","updated_at":"2020-06-04T07:21:25.000Z","dependencies_parsed_at":"2023-05-10T17:15:43.041Z","dependency_job_id":null,"html_url":"https://github.com/eMahtab/delete-node-in-a-linked-list","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/eMahtab/delete-node-in-a-linked-list","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eMahtab%2Fdelete-node-in-a-linked-list","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eMahtab%2Fdelete-node-in-a-linked-list/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eMahtab%2Fdelete-node-in-a-linked-list/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eMahtab%2Fdelete-node-in-a-linked-list/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eMahtab","download_url":"https://codeload.github.com/eMahtab/delete-node-in-a-linked-list/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eMahtab%2Fdelete-node-in-a-linked-list/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29466929,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-15T01:01:38.065Z","status":"online","status_checked_at":"2026-02-15T02:00:07.449Z","response_time":118,"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":["leetcode","linked-list","problem-solving"],"created_at":"2024-12-07T03:15:06.925Z","updated_at":"2026-02-15T03:31:18.612Z","avatar_url":"https://github.com/eMahtab.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Delete node in a linked list\n## https://leetcode.com/problems/delete-node-in-a-linked-list\n\nWrite a function to delete a node (except the tail) in a singly linked list, given only access to that node.\n\nGiven linked list -- head = [4,5,1,9].\n```\nExample 1:\n\nInput: head = [4,5,1,9], node = 5\nOutput: [4,1,9]\nExplanation: You are given the second node with value 5, the linked list should become 4 -\u003e 1 -\u003e 9 after calling your function.\n\nExample 2:\n\nInput: head = [4,5,1,9], node = 1\nOutput: [4,5,9]\nExplanation: You are given the third node with value 1, the linked list should become 4 -\u003e 5 -\u003e 9 after calling your function.\n``` \n\n**Note:**\n1. The linked list will have at least two elements.\n2. All of the nodes' values will be unique.\n3. The given node will not be the tail and it will always be a valid node of the linked list.\n4. Do not return anything from your function.\n\n# Implementation :\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 void deleteNode(ListNode node) {\n        node.val = node.next.val;\n        node.next = node.next.next;\n    }\n}\n```\n### Important :\nWe are given that initially there will be at least 2 nodes in the linked list, and we won't be deleting tail node. Which means `node.next` will not be null. \n\n# References :\nhttps://leetcode.com/articles/delete-node-linked-list\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femahtab%2Fdelete-node-in-a-linked-list","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femahtab%2Fdelete-node-in-a-linked-list","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femahtab%2Fdelete-node-in-a-linked-list/lists"}