{"id":625,"date":"2025-07-15T10:56:32","date_gmt":"2025-07-15T05:26:32","guid":{"rendered":"https:\/\/codeanddebug.in\/blog\/?p=625"},"modified":"2025-07-15T10:56:34","modified_gmt":"2025-07-15T05:26:34","slug":"design-linked-list-leetcode-707","status":"publish","type":"post","link":"https:\/\/codeanddebug.in\/blog\/design-linked-list-leetcode-707\/","title":{"rendered":"Design Linked List | Leetcode 707 | Explained in Python"},"content":{"rendered":"\n<p>The &#8220;Design Linked\u00a0List&#8221; problem\u00a0is a fundamental\u00a0data structure\u00a0question that\u00a0tests your understanding\u00a0of how linked\u00a0lists work and\u00a0how to implement\u00a0them from scratch.<\/p>\n\n\n\n<p>In this blog, we\u2019ll explain\u00a0the problem, the\u00a0intuition behind\u00a0each method, and\u00a0walk through\u00a0the implementation\u00a0step by step, making it easy\u00a0to follow for\u00a0students and\u00a0beginners.<\/p>\n\n\n\n<p>Here&#8217;s the [<strong><a href=\"https:\/\/leetcode.com\/problems\/design-linked-list\/\" target=\"_blank\" rel=\"noreferrer noopener\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\"><span style=\"text-decoration: underline;\">Problem Link<\/span><\/mark><\/a><\/strong>] to begin with.<\/p>\n\n\n<div style=\"max-width: -moz-fit-content; \" class=\"wp-block-ub-table-of-contents-block ub_table-of-contents ub_table-of-contents-collapsed\" id=\"ub_table-of-contents-a39ce5f2-b85e-4c08-8048-83294af78e80\" data-linktodivider=\"false\" data-showtext=\"show\" data-hidetext=\"hide\" data-scrolltype=\"auto\" data-enablesmoothscroll=\"true\" data-initiallyhideonmobile=\"false\" data-initiallyshow=\"false\"><div class=\"ub_table-of-contents-header-container\" style=\"\">\n\t\t\t<div class=\"ub_table-of-contents-header\" style=\"text-align: left; \">\n\t\t\t\t<div class=\"ub_table-of-contents-title\">Contents:<\/div>\n\t\t\t\t<div class=\"ub_table-of-contents-header-toggle\">\n\t\t\t<div class=\"ub_table-of-contents-toggle\" style=\"\">\n\t\t\t\u00a0[<a class=\"ub_table-of-contents-toggle-link\" href=\"#\" style=\"\">show<\/a>]\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t<\/div>\n\t\t<\/div><div class=\"ub_table-of-contents-extra-container\" style=\"\">\n\t\t\t<div class=\"ub_table-of-contents-container ub_table-of-contents-1-column ub-hide\">\n\t\t\t\t<ul style=\"\"><li style=\"\"><a href=\"https:\/\/codeanddebug.in\/blog\/design-linked-list-leetcode-707\/#0-what-does-the-problem-say\" style=\"\">What Does the Problem Say?<\/a><ul><li style=\"\"><a href=\"https:\/\/codeanddebug.in\/blog\/design-linked-list-leetcode-707\/#1-example\" style=\"\">Example<\/a><\/li><\/ul><\/li><li style=\"\"><a href=\"https:\/\/codeanddebug.in\/blog\/design-linked-list-leetcode-707\/#2-intuition-and-approach\" style=\"\">Intuition and Approach<\/a><ul><li style=\"\"><a href=\"https:\/\/codeanddebug.in\/blog\/design-linked-list-leetcode-707\/#3-why-linked-list\" style=\"\">Why Linked List?<\/a><\/li><li style=\"\"><a href=\"https:\/\/codeanddebug.in\/blog\/design-linked-list-leetcode-707\/#4-how-does-each-operation-work\" style=\"\">How Does Each Operation Work?<\/a><\/li><\/ul><\/li><li style=\"\"><a href=\"https:\/\/codeanddebug.in\/blog\/design-linked-list-leetcode-707\/#5-code-implementation\" style=\"\">Code Implementation<\/a><\/li><li style=\"\"><a href=\"https:\/\/codeanddebug.in\/blog\/design-linked-list-leetcode-707\/#6-code-explanation\" style=\"\">Code Explanation<\/a><\/li><li style=\"\"><a href=\"https:\/\/codeanddebug.in\/blog\/design-linked-list-leetcode-707\/#7-dry-run\" style=\"\">Dry Run<\/a><\/li><li style=\"\"><a href=\"https:\/\/codeanddebug.in\/blog\/design-linked-list-leetcode-707\/#8-time-and-space-complexity\" style=\"\">Time and Space Complexity<\/a><\/li><li style=\"\"><a href=\"https:\/\/codeanddebug.in\/blog\/design-linked-list-leetcode-707\/#9-conclusion\" style=\"\">Conclusion<\/a><\/li><\/ul>\n\t\t\t<\/div>\n\t\t<\/div><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"0-what-does-the-problem-say\">What Does the Problem Say?<\/h2>\n\n\n\n<p>You have to&nbsp;<strong>design your own singly linked list<\/strong>. Implement the following methods:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>get(index)<\/code>: Get the value of the index-th node. If the index is invalid, return -1.<\/li>\n\n\n\n<li><code>addAtHead(val)<\/code>: Add a node of value\u00a0<code>val<\/code>\u00a0before the first node.<\/li>\n\n\n\n<li><code>addAtTail(val)<\/code>: Append a node of value\u00a0<code>val<\/code>\u00a0as the last node.<\/li>\n\n\n\n<li><code>addAtIndex(index, val)<\/code>: Add a node of value\u00a0<code>val<\/code>\u00a0before the index-th node.<\/li>\n\n\n\n<li><code>deleteAtIndex(index)<\/code>: Delete the index-th node in the list if the index is valid.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"1-example\">Example<\/h3>\n\n\n\n<p><strong>Input:<\/strong><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro padding-bottom-disabled cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#e1e4e8;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#24292e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"[&quot;MyLinkedList&quot;,&quot;addAtHead&quot;,&quot;addAtTail&quot;,&quot;addAtIndex&quot;,&quot;get&quot;,&quot;deleteAtIndex&quot;,&quot;get&quot;]\n[[],[1],[3],[1,2],[1],[1],[1]]\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #E1E4E8\">[<\/span><span style=\"color: #9ECBFF\">&quot;MyLinkedList&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;addAtHead&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;addAtTail&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;addAtIndex&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;get&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;deleteAtIndex&quot;<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #9ECBFF\">&quot;get&quot;<\/span><span style=\"color: #E1E4E8\">]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">[[],[<\/span><span style=\"color: #79B8FF\">1<\/span><span style=\"color: #E1E4E8\">],[<\/span><span style=\"color: #79B8FF\">3<\/span><span style=\"color: #E1E4E8\">],[<\/span><span style=\"color: #79B8FF\">1<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #79B8FF\">2<\/span><span style=\"color: #E1E4E8\">],[<\/span><span style=\"color: #79B8FF\">1<\/span><span style=\"color: #E1E4E8\">],[<\/span><span style=\"color: #79B8FF\">1<\/span><span style=\"color: #E1E4E8\">],[<\/span><span style=\"color: #79B8FF\">1<\/span><span style=\"color: #E1E4E8\">]]<\/span><\/span><\/code><\/pre><span style=\"display:flex;align-items:flex-end;padding:10px;width:100%;justify-content:flex-end;background-color:#24292e;color:#d3d7dd;font-size:12px;line-height:1;position:relative\">Python<\/span><\/div>\n\n\n\n<p><strong>Explanation:<\/strong><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro padding-bottom-disabled cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#e1e4e8;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#24292e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"[null,null,null,null,2,null,3]\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #E1E4E8\">[null,null,null,null,<\/span><span style=\"color: #79B8FF\">2<\/span><span style=\"color: #E1E4E8\">,null,<\/span><span style=\"color: #79B8FF\">3<\/span><span style=\"color: #E1E4E8\">]<\/span><\/span><\/code><\/pre><span style=\"display:flex;align-items:flex-end;padding:10px;width:100%;justify-content:flex-end;background-color:#24292e;color:#d3d7dd;font-size:12px;line-height:1;position:relative\">Python<\/span><\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"2-intuition-and-approach\">Intuition and Approach<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"3-why-linked-list\">Why Linked List?<\/h3>\n\n\n\n<p>Unlike arrays, a linked list allows us to add or remove elements efficiently at the head, tail, or any given position&nbsp;<strong>without shifting other elements<\/strong>. Each node points to the next, and we control the connections.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"4-how-does-each-operation-work\">How Does Each Operation Work?<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>get(index)<\/strong>\n<ul class=\"wp-block-list\">\n<li>Start from the head and move to the next node\u00a0<code>index<\/code>\u00a0times.<\/li>\n\n\n\n<li>If you reach the desired index, return its value; otherwise, return -1.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>addAtHead(val)<\/strong>\n<ul class=\"wp-block-list\">\n<li>Create a new node.<\/li>\n\n\n\n<li>Set its next pointer to the current head.<\/li>\n\n\n\n<li>Update the head to this new node.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>addAtTail(val)<\/strong>\n<ul class=\"wp-block-list\">\n<li>Move to the end (last node) of the list.<\/li>\n\n\n\n<li>Set the next pointer of the last node to the new node.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>addAtIndex(index, val)<\/strong>\n<ul class=\"wp-block-list\">\n<li>Move to the node just before the target index.<\/li>\n\n\n\n<li>Insert the new node by adjusting pointers.<\/li>\n\n\n\n<li>Special case: if\u00a0<code>index<\/code>\u00a0is 0, use\u00a0<code>addAtHead<\/code>.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>deleteAtIndex(index)<\/strong>\n<ul class=\"wp-block-list\">\n<li>Move to the node just before the target index.<\/li>\n\n\n\n<li>Bypass the node to delete by adjusting pointers.<\/li>\n\n\n\n<li>Special case: if\u00a0<code>index<\/code>\u00a0is 0, move head pointer to the next node.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<p><strong>Why do we keep track of size?<\/strong><br>Tracking the size helps us quickly know if an index is valid for operations.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"5-code-implementation\">Code Implementation<\/h2>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro padding-bottom-disabled cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#e1e4e8;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#24292e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"class Node:\n    def __init__(self, val=0, next=None):\n        self.val = val              # Node value\n        self.next = next            # Pointer to next node\n\nclass MyLinkedList:\n    def __init__(self):\n        self.head = None            # Start of the list\n        self.size = 0               # Number of elements in list\n\n    def get(self, index: int) -&gt; int:\n        if index &lt; 0 or index &gt;= self.size:\n            return -1\n        temp = self.head\n        for _ in range(index):      # Move to index-th node\n            temp = temp.next\n        return temp.val\n\n    def addAtHead(self, val: int) -&gt; None:\n        node = Node(val, self.head) # New node points to current head\n        self.head = node            # Head is now the new node\n        self.size += 1\n\n    def addAtTail(self, val: int) -&gt; None:\n        node = Node(val)\n        if not self.head:           # If list is empty\n            self.head = node\n        else:\n            temp = self.head\n            while temp.next:        # Go to last node\n                temp = temp.next\n            temp.next = node        # Link last node to new node\n        self.size += 1\n\n    def addAtIndex(self, index: int, val: int) -&gt; None:\n        if index &lt; 0:\n            index = 0\n        if index &gt; self.size:       # Out of bounds\n            return\n        if index == 0:              # Add at head\n            self.addAtHead(val)\n        else:\n            prev = self.head\n            for _ in range(index - 1):\n                prev = prev.next    # Move to node before index\n            node = Node(val, prev.next)\n            prev.next = node        # Insert node\n            self.size += 1\n\n    def deleteAtIndex(self, index: int) -&gt; None:\n        if index &lt; 0 or index &gt;= self.size:  # Invalid index\n            return\n        if index == 0:                       # Delete head\n            self.head = self.head.next\n        else:\n            prev = self.head\n            for _ in range(index - 1):\n                prev = prev.next            # Move to node before index\n            prev.next = prev.next.next      # Bypass target node\n        self.size -= 1\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">class<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #B392F0\">Node<\/span><span style=\"color: #E1E4E8\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #F97583\">def<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">__init__<\/span><span style=\"color: #E1E4E8\">(self, val<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #79B8FF\">0<\/span><span style=\"color: #E1E4E8\">, next<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #79B8FF\">None<\/span><span style=\"color: #E1E4E8\">):<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">        <\/span><span style=\"color: #79B8FF\">self<\/span><span style=\"color: #E1E4E8\">.val <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> val              <\/span><span style=\"color: #6A737D\"># Node value<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">        <\/span><span style=\"color: #79B8FF\">self<\/span><span style=\"color: #E1E4E8\">.next <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">next<\/span><span style=\"color: #E1E4E8\">            <\/span><span style=\"color: #6A737D\"># Pointer to next node<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">class<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #B392F0\">MyLinkedList<\/span><span style=\"color: #E1E4E8\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #F97583\">def<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">__init__<\/span><span style=\"color: #E1E4E8\">(self):<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">        <\/span><span style=\"color: #79B8FF\">self<\/span><span style=\"color: #E1E4E8\">.head <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">None<\/span><span style=\"color: #E1E4E8\">            <\/span><span style=\"color: #6A737D\"># Start of the list<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">        <\/span><span style=\"color: #79B8FF\">self<\/span><span style=\"color: #E1E4E8\">.size <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">0<\/span><span style=\"color: #E1E4E8\">               <\/span><span style=\"color: #6A737D\"># Number of elements in list<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #F97583\">def<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #B392F0\">get<\/span><span style=\"color: #E1E4E8\">(self, index: <\/span><span style=\"color: #79B8FF\">int<\/span><span style=\"color: #E1E4E8\">) -&gt; <\/span><span style=\"color: #79B8FF\">int<\/span><span style=\"color: #E1E4E8\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">        <\/span><span style=\"color: #F97583\">if<\/span><span style=\"color: #E1E4E8\"> index <\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">0<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">or<\/span><span style=\"color: #E1E4E8\"> index <\/span><span style=\"color: #F97583\">&gt;=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">self<\/span><span style=\"color: #E1E4E8\">.size:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">            <\/span><span style=\"color: #F97583\">return<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">-<\/span><span style=\"color: #79B8FF\">1<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">        temp <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">self<\/span><span style=\"color: #E1E4E8\">.head<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">        <\/span><span style=\"color: #F97583\">for<\/span><span style=\"color: #E1E4E8\"> _ <\/span><span style=\"color: #F97583\">in<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">range<\/span><span style=\"color: #E1E4E8\">(index):      <\/span><span style=\"color: #6A737D\"># Move to index-th node<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">            temp <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> temp.next<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">        <\/span><span style=\"color: #F97583\">return<\/span><span style=\"color: #E1E4E8\"> temp.val<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #F97583\">def<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #B392F0\">addAtHead<\/span><span style=\"color: #E1E4E8\">(self, val: <\/span><span style=\"color: #79B8FF\">int<\/span><span style=\"color: #E1E4E8\">) -&gt; <\/span><span style=\"color: #79B8FF\">None<\/span><span style=\"color: #E1E4E8\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">        node <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> Node(val, <\/span><span style=\"color: #79B8FF\">self<\/span><span style=\"color: #E1E4E8\">.head) <\/span><span style=\"color: #6A737D\"># New node points to current head<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">        <\/span><span style=\"color: #79B8FF\">self<\/span><span style=\"color: #E1E4E8\">.head <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> node            <\/span><span style=\"color: #6A737D\"># Head is now the new node<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">        <\/span><span style=\"color: #79B8FF\">self<\/span><span style=\"color: #E1E4E8\">.size <\/span><span style=\"color: #F97583\">+=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">1<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #F97583\">def<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #B392F0\">addAtTail<\/span><span style=\"color: #E1E4E8\">(self, val: <\/span><span style=\"color: #79B8FF\">int<\/span><span style=\"color: #E1E4E8\">) -&gt; <\/span><span style=\"color: #79B8FF\">None<\/span><span style=\"color: #E1E4E8\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">        node <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> Node(val)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">        <\/span><span style=\"color: #F97583\">if<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">not<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">self<\/span><span style=\"color: #E1E4E8\">.head:           <\/span><span style=\"color: #6A737D\"># If list is empty<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">            <\/span><span style=\"color: #79B8FF\">self<\/span><span style=\"color: #E1E4E8\">.head <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> node<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">        <\/span><span style=\"color: #F97583\">else<\/span><span style=\"color: #E1E4E8\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">            temp <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">self<\/span><span style=\"color: #E1E4E8\">.head<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">            <\/span><span style=\"color: #F97583\">while<\/span><span style=\"color: #E1E4E8\"> temp.next:        <\/span><span style=\"color: #6A737D\"># Go to last node<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">                temp <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> temp.next<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">            temp.next <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> node        <\/span><span style=\"color: #6A737D\"># Link last node to new node<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">        <\/span><span style=\"color: #79B8FF\">self<\/span><span style=\"color: #E1E4E8\">.size <\/span><span style=\"color: #F97583\">+=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">1<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #F97583\">def<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #B392F0\">addAtIndex<\/span><span style=\"color: #E1E4E8\">(self, index: <\/span><span style=\"color: #79B8FF\">int<\/span><span style=\"color: #E1E4E8\">, val: <\/span><span style=\"color: #79B8FF\">int<\/span><span style=\"color: #E1E4E8\">) -&gt; <\/span><span style=\"color: #79B8FF\">None<\/span><span style=\"color: #E1E4E8\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">        <\/span><span style=\"color: #F97583\">if<\/span><span style=\"color: #E1E4E8\"> index <\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">0<\/span><span style=\"color: #E1E4E8\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">            index <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">0<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">        <\/span><span style=\"color: #F97583\">if<\/span><span style=\"color: #E1E4E8\"> index <\/span><span style=\"color: #F97583\">&gt;<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">self<\/span><span style=\"color: #E1E4E8\">.size:       <\/span><span style=\"color: #6A737D\"># Out of bounds<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">            <\/span><span style=\"color: #F97583\">return<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">        <\/span><span style=\"color: #F97583\">if<\/span><span style=\"color: #E1E4E8\"> index <\/span><span style=\"color: #F97583\">==<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">0<\/span><span style=\"color: #E1E4E8\">:              <\/span><span style=\"color: #6A737D\"># Add at head<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">            <\/span><span style=\"color: #79B8FF\">self<\/span><span style=\"color: #E1E4E8\">.addAtHead(val)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">        <\/span><span style=\"color: #F97583\">else<\/span><span style=\"color: #E1E4E8\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">            prev <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">self<\/span><span style=\"color: #E1E4E8\">.head<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">            <\/span><span style=\"color: #F97583\">for<\/span><span style=\"color: #E1E4E8\"> _ <\/span><span style=\"color: #F97583\">in<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">range<\/span><span style=\"color: #E1E4E8\">(index <\/span><span style=\"color: #F97583\">-<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">1<\/span><span style=\"color: #E1E4E8\">):<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">                prev <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> prev.next    <\/span><span style=\"color: #6A737D\"># Move to node before index<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">            node <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> Node(val, prev.next)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">            prev.next <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> node        <\/span><span style=\"color: #6A737D\"># Insert node<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">            <\/span><span style=\"color: #79B8FF\">self<\/span><span style=\"color: #E1E4E8\">.size <\/span><span style=\"color: #F97583\">+=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">1<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #F97583\">def<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #B392F0\">deleteAtIndex<\/span><span style=\"color: #E1E4E8\">(self, index: <\/span><span style=\"color: #79B8FF\">int<\/span><span style=\"color: #E1E4E8\">) -&gt; <\/span><span style=\"color: #79B8FF\">None<\/span><span style=\"color: #E1E4E8\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">        <\/span><span style=\"color: #F97583\">if<\/span><span style=\"color: #E1E4E8\"> index <\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">0<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">or<\/span><span style=\"color: #E1E4E8\"> index <\/span><span style=\"color: #F97583\">&gt;=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">self<\/span><span style=\"color: #E1E4E8\">.size:  <\/span><span style=\"color: #6A737D\"># Invalid index<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">            <\/span><span style=\"color: #F97583\">return<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">        <\/span><span style=\"color: #F97583\">if<\/span><span style=\"color: #E1E4E8\"> index <\/span><span style=\"color: #F97583\">==<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">0<\/span><span style=\"color: #E1E4E8\">:                       <\/span><span style=\"color: #6A737D\"># Delete head<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">            <\/span><span style=\"color: #79B8FF\">self<\/span><span style=\"color: #E1E4E8\">.head <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">self<\/span><span style=\"color: #E1E4E8\">.head.next<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">        <\/span><span style=\"color: #F97583\">else<\/span><span style=\"color: #E1E4E8\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">            prev <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">self<\/span><span style=\"color: #E1E4E8\">.head<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">            <\/span><span style=\"color: #F97583\">for<\/span><span style=\"color: #E1E4E8\"> _ <\/span><span style=\"color: #F97583\">in<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">range<\/span><span style=\"color: #E1E4E8\">(index <\/span><span style=\"color: #F97583\">-<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">1<\/span><span style=\"color: #E1E4E8\">):<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">                prev <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> prev.next            <\/span><span style=\"color: #6A737D\"># Move to node before index<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">            prev.next <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> prev.next.next      <\/span><span style=\"color: #6A737D\"># Bypass target node<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">        <\/span><span style=\"color: #79B8FF\">self<\/span><span style=\"color: #E1E4E8\">.size <\/span><span style=\"color: #F97583\">-=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">1<\/span><\/span><\/code><\/pre><span style=\"display:flex;align-items:flex-end;padding:10px;width:100%;justify-content:flex-end;background-color:#24292e;color:#d3d7dd;font-size:12px;line-height:1;position:relative\">Python<\/span><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"6-code-explanation\">Code Explanation<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The\u00a0<code>Node<\/code>\u00a0class is a simple building block for the linked list, storing a value and a pointer to the next node.<\/li>\n\n\n\n<li>The\u00a0<code>MyLinkedList<\/code>\u00a0class keeps track of the list\u2019s head and size.<\/li>\n\n\n\n<li>Each method manipulates the pointers and size to ensure the list remains valid after every operation.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"7-dry-run\">Dry Run<\/h2>\n\n\n\n<p>Let\u2019s visualize the following operations step by step:<\/p>\n\n\n\n<p><strong>Operations:<\/strong><br><code>addAtHead(1) \u27f6 addAtTail(3) \u27f6 addAtIndex(1,2) \u27f6 get(1) \u27f6 deleteAtIndex(1) \u27f6 get(1)<\/code><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>addAtHead(1):<\/strong>\u00a0List &#8211;\u00a0<a href=\"https:\/\/leetcode.com\/problems\/design-linked-list\/description\/\" target=\"_blank\" rel=\"noreferrer noopener\"><\/a><\/li>\n\n\n\n<li><strong>addAtTail(3):<\/strong>\u00a0List &#8211;\u00a0<a href=\"https:\/\/leetcode.com\/problems\/design-linked-list\/description\/\" target=\"_blank\" rel=\"noreferrer noopener\"><\/a><\/li>\n\n\n\n<li><strong>addAtIndex(1, 2):<\/strong>\u00a0Move to node at index 0 (1), insert 2 after 1 \u2192 [1,<\/li>\n\n\n\n<li><strong>get(1):<\/strong>\u00a0Move to node at index 1 \u2192 Value is 2<\/li>\n\n\n\n<li><strong>deleteAtIndex(1):<\/strong>\u00a0Move to node at index 0 (1), skip the next node. Now list is\u00a0<a href=\"https:\/\/leetcode.com\/problems\/design-linked-list\/description\/\" target=\"_blank\" rel=\"noreferrer noopener\"><\/a><\/li>\n\n\n\n<li><strong>get(1):<\/strong>\u00a0Move to node at index 1 \u2192 Value is 3<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"8-time-and-space-complexity\">Time and Space Complexity<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>All operations:<\/strong>\u00a0O(n) in the worst case (since you may need to traverse the list)<\/li>\n\n\n\n<li><strong>Space Complexity:<\/strong>\u00a0O(1) extra (not counting the nodes themselves)<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"9-conclusion\">Conclusion<\/h2>\n\n\n\n<p>Designing a linked list from scratch is great practice for learning pointers and dynamic data structures. Mastering these building blocks helps you understand more complex data structures and memory management.<\/p>\n\n\n\n<p>If you practice and understand each step, you\u2019ll be able to design your own linked lists and even more advanced structures in the future!<\/p>\n\n\n\n<div class=\"wp-block-buttons is-content-justification-center is-layout-flex wp-container-core-buttons-is-layout-16018d1d wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/codeanddebug.in\/course\/zero-to-hero-python-dsa\" target=\"_blank\" rel=\"noreferrer noopener\">Join our Advance DSA COURSE<\/a><\/div>\n<\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><em>For any changes to the article, kindly email at <a href=\"mailto:code@codeanddebug.in\" target=\"_blank\" rel=\"noreferrer noopener\">code@codeanddebug.in<\/a> or contact us at <a href=\"tel:+91-9712928220\" target=\"_blank\" rel=\"noreferrer noopener\">+91-9712928220<\/a>.<\/em><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The &#8220;Design Linked\u00a0List&#8221; problem\u00a0is a fundamental\u00a0data structure\u00a0question that\u00a0tests your understanding\u00a0of how linked\u00a0lists work and\u00a0how to implement\u00a0them from scratch. In this blog, we\u2019ll explain\u00a0the problem, the\u00a0intuition behind\u00a0each method, and\u00a0walk through\u00a0the implementation\u00a0step by step, making it easy\u00a0to follow for\u00a0students and\u00a0beginners. Here&#8217;s the [Problem Link] to begin with. What Does the Problem Say? You have to&nbsp;design your own<\/p>\n","protected":false},"author":1,"featured_media":626,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,4],"tags":[8,29],"class_list":{"0":"post-625","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-data-structures-and-algorithm","8":"category-beginner","9":"tag-easy","10":"tag-singly-linked-list"},"featured_image_src":"https:\/\/codeanddebug.in\/blog\/wp-content\/uploads\/2025\/07\/design-linked-list-featured-image.png","author_info":{"display_name":"codeanddebug","author_link":"https:\/\/codeanddebug.in\/blog\/author\/codeanddebug\/"},"_links":{"self":[{"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/posts\/625","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/comments?post=625"}],"version-history":[{"count":2,"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/posts\/625\/revisions"}],"predecessor-version":[{"id":630,"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/posts\/625\/revisions\/630"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/media\/626"}],"wp:attachment":[{"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/media?parent=625"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/categories?post=625"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/tags?post=625"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}