{"id":3918,"date":"2021-08-17T13:55:19","date_gmt":"2021-08-17T13:55:19","guid":{"rendered":"https:\/\/www.prepbytes.com\/blog\/?p=3918"},"modified":"2023-07-24T07:37:45","modified_gmt":"2023-07-24T07:37:45","slug":"count-duplicates-in-a-linked-list","status":"publish","type":"post","link":"https:\/\/prepbytes.com\/blog\/count-duplicates-in-a-linked-list\/","title":{"rendered":"Count duplicates in a Linked List"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645617231372-count%20duplicates%20in%20linked%20list-05-05%20%281%29.png\" alt=\"\" \/><\/p>\n<p>This article aims to aid you in understanding how to find duplicate in linked list. Familiarity with linked lists can be advantageous for succeeding in IT interviews, as a solid understanding of these data structures is often sought after during coding assessments. Without further ado, let&#8217;s delve into our topic of finding duplicates in a linked list.<\/p>\n<h3>How to find duplicate in Linked List?<\/h3>\n<p>In this question, we are given a singly linked list. We have to count the number of duplicate nodes in the linked list<\/p>\n<h3>Problem Statement Understanding To Find Duplicate Elements In Linked List<\/h3>\n<p>Let\u2019s first understand the problem statement with help of examples.<\/p>\n<p>Suppose the given list is:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/prepbytes.com\/blog\/wp-content\/uploads\/2021\/08\/given-list-1-1.png\" alt=\"\" \/><\/p>\n<p>We have to count the number of duplicate nodes in the list.<\/p>\n<p>From the above given linked list, we can see that:<\/p>\n<ul>\n<li>Count of each 1 and 8 is 2 in the linked list.<\/li>\n<li>While the count of 7 is 1 in the linked list.<\/li>\n<\/ul>\n<p>So, we can say that duplicates of  1 and 8 exist in the linked list, 1 duplicate each of 1 and 8 exists in the linked list. So, we will return the count of duplicate node in the linked list as (1+1) = 2.<\/p>\n<p>If the given linked list is:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/prepbytes.com\/blog\/wp-content\/uploads\/2021\/08\/given-list-2.png\" alt=\"\" \/><\/p>\n<p>For the above-linked list, we can see that:<\/p>\n<ul>\n<li>Count of each 1, 2, 3 is 2 in the linked list.<\/li>\n<li>The count of  5 is 3.<\/li>\n<li>While the count of 4 is 1 in the linked list.<\/li>\n<\/ul>\n<p>So, we can say that duplicates of  1, 2, 3, and 5 exist in the linked list, 1 duplicate each of 1, 2, and 3 exist and 2 duplicates of 5 exist. So, we will return the count of duplicate node in the linked list as (1+1+1+2) = 5.<\/p>\n<p>Now, I think it is clear from the examples what we have to do with the problem. So let\u2019s move to approach.<\/p>\n<p>Before jumping to approach, just try to think how can you approach this problem?<\/p>\n<p>It&#8217;s okay if your solution is brute force, we will try to optimize it together.<\/p>\n<p>We will first make use of simple nested list traversal to find the duplicates, although it will be a brute-force approach, it is necessary to build the foundation. <\/p>\n<p>Let us have a glance at brute force approaches.<\/p>\n<h3>Approach and Algorithm (Brute Force) To Find Duplicate Elements In Linked List<\/h3>\n<p>The approach is going to be pretty simple. <\/p>\n<ul>\n<li>We will create a variable count and initialize it to 0. <\/li>\n<li>Now, we will traverse through the list, and for every node, we will traverse from its next node to the end of the list whenever we will find a match, we will increase the counter and will break out of the loop. Basically here what we are trying to find out is that is this particular node duplicate or not.<\/li>\n<\/ul>\n<p>This method has a time complexity of O(n<sup>2<\/sup>) as it is using nested traversal. <\/p>\n<p>Can we do better?<br \/>\nYes. We can do better. We can do it in O(n) with the help of hashing. <\/p>\n<p>Let us see the efficient approach.<\/p>\n<h3>Approach (Hashing) To Find Duplicate Elements In Linked List<\/h3>\n<p>In this approach, we will use hashing. <\/p>\n<ul>\n<li>Firstly, we will create an unordered set, and we will insert the data of the head in the set. <\/li>\n<li>We will also create a counter whose initial value will be 0. <\/li>\n<li>Now, we will traverse through the list, starting from the next node, and for every node, we will check if that node is already present in the set or not. If it is present, we will increment the counter. We will also keep inserting the nodes, that we are traversing, in the set.<\/li>\n<\/ul>\n<h3>Algorithm To Find Duplicate Elements In Linked List<\/h3>\n<ul>\n<li>Base Case &#8211; If the head is NULL, return 0.<\/li>\n<li>Create an unordered set, say s, and a variable count with an initial value of 0.<\/li>\n<li>Insert the head \u2192 data in the set.<\/li>\n<li>Traverse from the next node of the head till the end of the list.<\/li>\n<li>In every iteration, check if the node\u2019s data is already present in the set or not. If present, increment the count.<\/li>\n<li>Insert the current node\u2019s data in the set.<\/li>\n<li>In the end, return the count variable.<\/li>\n<\/ul>\n<h3>Dry Run To Find Duplicate Elements In Linked List<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/prepbytes.com\/blog\/wp-content\/uploads\/2021\/08\/Count-duplicates-nodes-in-a-given-Linked-List.png\" alt=\"\" \/><\/p>\n<h3>Code Implementation<\/h3>\n\t\t\t\t\t\t<style>\r\n\t\t\t\t\r\n\t\t\t\t\t#tab_container_3919 {\r\n\toverflow:hidden;\r\n\tdisplay:block;\r\n\twidth:100%;\r\n\tborder:0px solid #ddd;\r\n\tmargin-bottom:30px;\r\n\t}\r\n\r\n#tab_container_3919 .tab-content{\r\n\tpadding:20px;\r\n\tborder: 1px solid #e6e6e6 !important;\r\n\tmargin-top: 0px;\r\n\tbackground-color:#ffffff !important;\r\n\tcolor: #000000 !important;\r\n\tfont-size:16px !important;\r\n\tfont-family: Open Sans !important;\r\n\t\r\n\t\tborder: 1px solid #e6e6e6 !important;\r\n\t}\r\n#tab_container_3919 .wpsm_nav-tabs {\r\n    border-bottom: 0px solid #ddd;\r\n}\r\n#tab_container_3919 .wpsm_nav-tabs > li.active > a, #tab_container_3919 .wpsm_nav-tabs > li.active > a:hover, #tab_container_3919 .wpsm_nav-tabs > li.active > a:focus {\r\n\tcolor: #000000 !important;\r\n\tcursor: default;\r\n\tbackground-color: #ffffff !important;\r\n\tborder: 1px solid #e6e6e6 !important;\r\n}\r\n\r\n#tab_container_3919 .wpsm_nav-tabs > li > a {\r\n    margin-right: 0px !important; \r\n    line-height: 1.42857143 !important;\r\n    border: 1px solid #d5d5d5 !important;\r\n    border-radius: 0px 0px 0 0 !important; \r\n\tbackground-color: #e8e8e8 !important;\r\n\tcolor: #000000 !important;\r\n\tpadding: 15px 18px 15px 18px !important;\r\n\ttext-decoration: none !important;\r\n\tfont-size: 14px !important;\r\n\ttext-align:center !important;\r\n\tfont-family: Open Sans !important;\r\n}\r\n#tab_container_3919 .wpsm_nav-tabs > li > a:focus {\r\noutline: 0px !important;\r\n}\r\n\r\n#tab_container_3919 .wpsm_nav-tabs > li > a:before {\r\n\tdisplay:none !important;\r\n}\r\n#tab_container_3919 .wpsm_nav-tabs > li > a:after {\r\n\tdisplay:none !important ;\r\n}\r\n#tab_container_3919 .wpsm_nav-tabs > li{\r\npadding:0px !important ;\r\nmargin:0px;\r\n}\r\n\r\n#tab_container_3919 .wpsm_nav-tabs > li > a:hover , #tab_container_3919 .wpsm_nav-tabs > li > a:focus {\r\n    color: #000000 !important;\r\n    background-color: #e8e8e8 !important;\r\n\tborder: 1px solid #d5d5d5 !important;\r\n\t\r\n}\r\n#tab_container_3919 .wpsm_nav-tabs > li > a .fa{\r\n\r\nmargin-right:5px !important;\r\n\r\nmargin-left:5px !important;\r\n\r\n\r\n}\r\n\r\n\t\t#tab_container_3919 .wpsm_nav-tabs a{\r\n\t\t\tbackground-image: none;\r\n\t\t\tbackground-position: 0 0;\r\n\t\t\tbackground-repeat: repeat-x;\r\n\t\t}\r\n\t\t\t\r\n\r\n\r\n#tab_container_3919 .wpsm_nav-tabs > li {\r\n    float: left;\r\n    margin-bottom: -1px !important;\r\n\tmargin-right:0px !important; \r\n}\r\n\r\n\r\n#tab_container_3919 .tab-content{\r\noverflow:hidden !important;\r\n}\r\n\r\n\r\n@media (min-width: 769px) {\r\n\r\n\t#tab_container_3919 .wpsm_nav-tabs > li{\r\n\t\tfloat:left !important ;\r\n\t\t\t\tmargin-right:-1px !important;\r\n\t\t\t\t\t}\r\n\t#tab_container_3919 .wpsm_nav-tabs{\r\n\t\tfloat:none !important;\r\n\t\tmargin:0px !important;\r\n\t}\r\n\r\n\t#tab_container_3919 .wpsm_nav-tabs > li {\r\n\t\t\t\t\r\n\t}\r\n\t#tab_container_3919 .wpsm_nav{\r\n\t\t\t}\r\n\r\n}\r\n\r\n\r\n\r\n@media (max-width: 768px) {\r\n\t#tab_container_3919 .wpsm_nav-tabs > li {\r\n\t\t\t\t\r\n\t}\r\n\t#tab_container_3919 .wpsm_nav{\r\n\t\t\t}\r\n}\r\n\r\n\r\n\t.wpsm_nav-tabs li:before{\r\n\t\tdisplay:none !important;\r\n\t}\r\n\r\n\t@media (max-width: 768px) {\r\n\t\t\t\t\r\n\t\t\t\t.wpsm_nav-tabs{\r\n\t\t\tmargin-left:0px !important;\r\n\t\t\tmargin-right:0px !important; \r\n\t\t\t\r\n\t\t}\r\n\t\t\t\t#tab_container_3919 .wpsm_nav-tabs > li{\r\n\t\t\tfloat:none !important;\r\n\t\t}\r\n\t\t\t\r\n\t}\t\t\t\t<\/style>\r\n\t\t\t\t<div id=\"tab_container_3919\" >\r\n\t \r\n\t\t\t\t\t<ul class=\"wpsm_nav wpsm_nav-tabs\" role=\"tablist\" id=\"myTab_3919\">\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t<li role=\"presentation\"  class=\"active\"  onclick=\"do_resize()\">\r\n\t\t\t\t\t\t\t\t<a href=\"#tabs_desc_3919_1\" aria-controls=\"tabs_desc_3919_1\" role=\"tab\" data-toggle=\"tab\">\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"fa fa-code\"><\/i> \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t<span>C<\/span>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t<\/a>\r\n\t\t\t\t\t\t\t<\/li>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t<li role=\"presentation\"  onclick=\"do_resize()\">\r\n\t\t\t\t\t\t\t\t<a href=\"#tabs_desc_3919_2\" aria-controls=\"tabs_desc_3919_2\" role=\"tab\" data-toggle=\"tab\">\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"fa fa-code\"><\/i> \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t<span>C++<\/span>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t<\/a>\r\n\t\t\t\t\t\t\t<\/li>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t<li role=\"presentation\"  onclick=\"do_resize()\">\r\n\t\t\t\t\t\t\t\t<a href=\"#tabs_desc_3919_3\" aria-controls=\"tabs_desc_3919_3\" role=\"tab\" data-toggle=\"tab\">\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"fa fa-code\"><\/i> \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t<span>Java<\/span>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t<\/a>\r\n\t\t\t\t\t\t\t<\/li>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t<li role=\"presentation\"  onclick=\"do_resize()\">\r\n\t\t\t\t\t\t\t\t<a href=\"#tabs_desc_3919_4\" aria-controls=\"tabs_desc_3919_4\" role=\"tab\" data-toggle=\"tab\">\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"fa fa-code\"><\/i> \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t<span>Python<\/span>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t<\/a>\r\n\t\t\t\t\t\t\t<\/li>\r\n\t\t\t\t\t\t\t\t\t\t\t <\/ul>\r\n\r\n\t\t\t\t\t  <!-- Tab panes -->\r\n\t\t\t\t\t  <div class=\"tab-content\" id=\"tab-content_3919\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t <div role=\"tabpanel\" class=\"tab-pane  in active \" id=\"tabs_desc_3919_1\">\r\n\t\t\t\t\t\t\t\t<!-- wp:enlighter\/codeblock {\"language\":\"c\"} -->\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\r\n#include&lt;stdio.h&gt;\r\n#include&lt;stdlib.h&gt;\r\n\r\nstruct Node { \r\n    int data; \r\n    struct Node* next; \r\n}; \r\n\r\n\r\n\/\/ Function to insert a node at the beginning \r\nvoid insert(struct Node** head, int item) \r\n{ \r\n    struct Node* temp = (struct Node*)malloc(sizeof(struct Node));\r\n    temp-&gt;data = item; \r\n    temp-&gt;next = *head; \r\n    *head = temp; \r\n} \r\n\r\n\/\/ Function to count the number of \r\n\/\/ duplicate nodes in the linked list \r\nint countNode(struct Node* head) \r\n{ \r\n    int count = 0; \r\n\r\n    while (head-&gt;next != NULL) { \r\n\r\n        \/\/ Starting from the next node \r\n        struct Node *ptr = head-&gt;next; \r\n        while (ptr != NULL) { \r\n\r\n            \/\/ If some duplicate node is found \r\n            if (head-&gt;data == ptr-&gt;data) { \r\n                count++; \r\n                break; \r\n            } \r\n            ptr = ptr-&gt;next; \r\n        } \r\n\r\n        head = head-&gt;next; \r\n    } \r\n\r\n    \/\/ Return the count of duplicate nodes \r\n    return count; \r\n} \r\n\r\n\/\/ Main function\r\nint main() \r\n{ \r\n    struct Node* head = NULL; \r\n    insert(&amp;head, 5); \r\n    insert(&amp;head, 7); \r\n    insert(&amp;head, 5); \r\n    insert(&amp;head, 4); \r\n    insert(&amp;head, 7); \r\n\r\n    int ans = countNode(head); \r\n    printf(&quot;%d&quot;, ans);\r\n    return 0; \r\n} \r\n<\/pre>\r\n<!-- \/wp:enlighter\/codeblock -->\t\t\t\t\t\t <\/div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t <div role=\"tabpanel\" class=\"tab-pane \" id=\"tabs_desc_3919_2\">\r\n\t\t\t\t\t\t\t\t<!-- wp:enlighter\/codeblock {\"language\":\"cpp\"} -->\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"cpp\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\r\n#include &lt;iostream&gt;\r\n#include &lt;unordered_set&gt;\r\nusing namespace std;\r\n\r\nstruct Node {\r\n    int data;\r\n    Node* next;\r\n};\r\n\r\nvoid insert(Node** head, int item)\r\n{\r\n    Node* temp = new Node();\r\n    temp-&gt;data = item;\r\n    temp-&gt;next = *head;\r\n    *head = temp;\r\n}\r\n\r\nint countNode(Node* head)\r\n{\r\n    if (head == NULL)\r\n       return 0;;\r\n\r\n    unordered_set&lt;int&gt; s;\r\n    s.insert(head-&gt;data);\r\n\r\n    int count = 0;\r\n    for (Node *curr=head-&gt;next; curr != NULL; curr=curr-&gt;next) {\r\n        if (s.find(curr-&gt;data) != s.end())\r\n             count++;\r\n \r\n        s.insert(curr-&gt;data);\r\n    }\r\n\r\n    return count;\r\n}\r\n \r\n\r\nint main()\r\n{\r\n    Node* head = NULL;\r\n    insert(&amp;head, 8);\r\n    insert(&amp;head, 8);\r\n    insert(&amp;head, 1);\r\n    insert(&amp;head, 7);\r\n    insert(&amp;head, 1);\r\n \r\n    cout &lt;&lt; countNode(head);\r\n \r\n    return 0;\r\n}\r\n\r\n<\/pre>\r\n<!-- \/wp:enlighter\/codeblock -->\r\n\t\t\t\t\t\t <\/div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t <div role=\"tabpanel\" class=\"tab-pane \" id=\"tabs_desc_3919_3\">\r\n\t\t\t\t\t\t\t\t<!-- wp:enlighter\/codeblock {\"language\":\"java\"} -->\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\r\nimport java.util.HashSet;\r\n \r\npublic class PrepBytes\r\n{\r\n \r\n\r\nstatic class Node\r\n{\r\n    int data;\r\n    Node next;\r\n};\r\nstatic Node head;\r\n\r\nstatic void insert(Node ref_head, int item)\r\n{\r\n    Node temp = new Node();\r\n    temp.data = item;\r\n    temp.next = ref_head;\r\n    head = temp;\r\n     \r\n}\r\n\r\nstatic int countNode(Node head)\r\n{\r\n    if (head == null)\r\n    return 0;;\r\n\r\n    HashSet&lt;integer&gt;s = new HashSet&lt;&gt;();\r\n    s.add(head.data);\r\n\r\n    int count = 0;\r\n    for (Node curr=head.next; curr != null; curr=curr.next)\r\n    {\r\n        if (s.contains(curr.data))\r\n            count++;\r\n \r\n        s.add(curr.data);\r\n    }\r\n\r\n    return count;\r\n}\r\n\r\npublic static void main(String[] args)\r\n{\r\n \r\n    insert(head, 8);\r\n    insert(head, 8);\r\n    insert(head, 1);\r\n    insert(head, 7);\r\n    insert(head, 1);\r\n \r\n    System.out.println(countNode(head));\r\n}\r\n}\r\n\r\n<\/pre>\r\n<!-- \/wp:enlighter\/codeblock -->\r\n\t\t\t\t\t\t <\/div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t <div role=\"tabpanel\" class=\"tab-pane \" id=\"tabs_desc_3919_4\">\r\n\t\t\t\t\t\t\t\t<!-- wp:enlighter\/codeblock {\"language\":\"python\"} -->\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\r\nclass Node:\r\n    def __init__(self, data = None, next = None):\r\n        self.next = next\r\n        self.data = data\r\n\r\nhead = None\r\n\r\ndef insert(ref_head, item):\r\n    global head\r\n    temp = Node()\r\n    temp.data = item\r\n    temp.next = ref_head\r\n    head = temp\r\n    \r\ndef countNode(head):\r\n\r\n    if (head == None):\r\n        return 0\r\n\r\n    s = set()\r\n    s.add(head.data)\r\n    count = 0\r\n    curr = head.next\r\n    while ( curr != None ) :\r\n        if (curr.data in s):\r\n            count = count + 1\r\n\r\n        s.add(curr.data)\r\n        curr = curr.next\r\n    return count\r\n\r\ninsert(head, 8)\r\ninsert(head, 8)\r\ninsert(head, 1)\r\ninsert(head, 7)\r\ninsert(head, 1)\r\n\r\nprint(countNode(head))\r\n\r\n<\/pre>\r\n<!-- \/wp:enlighter\/codeblock -->\t\t\t\t\t\t <\/div>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t <\/div>\r\n\t\t\t\t\t \r\n\t\t\t\t <\/div>\r\n <script>\r\n\t\tjQuery(function () {\r\n\t\t\tjQuery('#myTab_3919 a:first').tab('show')\r\n\t\t});\r\n\t\t\r\n\t\t\t\tjQuery(function(){\r\n\t\t\tvar b=\"fadeIn\";\r\n\t\t\tvar c;\r\n\t\t\tvar a;\r\n\t\t\td(jQuery(\"#myTab_3919 a\"),jQuery(\"#tab-content_3919\"));function d(e,f,g){\r\n\t\t\t\te.click(function(i){\r\n\t\t\t\t\ti.preventDefault();\r\n\t\t\t\t\tjQuery(this).tab(\"show\");\r\n\t\t\t\t\tvar h=jQuery(this).data(\"easein\");\r\n\t\t\t\t\tif(c){c.removeClass(a);}\r\n\t\t\t\t\tif(h){f.find(\"div.active\").addClass(\"animated \"+h);a=h;}\r\n\t\t\t\t\telse{if(g){f.find(\"div.active\").addClass(\"animated \"+g);a=g;}else{f.find(\"div.active\").addClass(\"animated \"+b);a=b;}}c=f.find(\"div.active\");\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\r\n\t\tfunction do_resize(){\r\n\r\n\t\t\tvar width=jQuery( '.tab-content .tab-pane iframe' ).width();\r\n\t\t\tvar height=jQuery( '.tab-content .tab-pane iframe' ).height();\r\n\r\n\t\t\tvar toggleSize = true;\r\n\t\t\tjQuery('iframe').animate({\r\n\t\t\t    width: toggleSize ? width : 640,\r\n\t\t\t    height: toggleSize ? height : 360\r\n\t\t\t  }, 250);\r\n\r\n\t\t\t  toggleSize = !toggleSize;\r\n\t\t}\r\n\r\n\r\n\t<\/script>\r\n\t\t\t\t\r\n\t\t\t\n<h3>Output<\/h3>\n<p>2<\/p>\n<p><strong>Time Complexity To Find Duplicate Elements In Linked List:<\/strong> O(n), as list traversal is needed.<\/p>\n<p>This article will help you to understand how to find duplicate in linked list. There is a lot of stuff to prepare for the interviews but data structures and algorithms  are the most important topics as these are the must needed skills for any company. This is an important question when it comes to coding interviews. If you want to solve more questions on Linked List, which is curated by our expert mentors at PrepBytes, you can follow this link <a href=\"https:\/\/mycode.prepbytes.com\/interview-coding\/practice\/linked-list\"> Linked List<\/a>.<\/p>\n<p>**Conclusion**<br \/>\nThe process of counting duplicates in a linked list using hashing is an efficient algorithm that can be helpful in identifying and handling duplicate elements effectively. By utilizing a hash table, we can keep track of unique elements as we traverse the linked list, and whenever a duplicate is encountered, we can take appropriate actions based on the requirements (e.g., printing, deleting, or marking the duplicate node). This approach ensures that the duplicate elements are managed with a time complexity of O(n), where n is the number of nodes in the linked list.<\/p>\n<h2>FAQ Related To Find Duplicate Elements In Linked List<\/h2>\n<p>**Q1. What is the time complexity for searching for an element on a Linked List?**<br \/>\nSince there is no way of accessing any node without visiting its previous node, we have to traverse the entire Linked List every time we need to search for an element. Therefore, the worst-case time complexity is O(N) where N is the number of elements in a Linked List.<\/p>\n<p>**Q2. How do you find duplicates in a linked list?**<br \/>\nWe traverse the whole linked list. For each node, we check in the remaining list whether the duplicate node exists or not. If it does then we increment the count.<\/p>\n<p>**Q3. Is a linked list dynamic?**><br \/>\nLinked List is a dynamic structure, which means the list can grow or shrink depending on the data making it more powerful and flexible than Arrays. Unlike Arrays, Linked List is not stored in a contiguous memory location. Each element in the list is spread across the memory and are linked by the pointers in the Node.<\/p>\n<p>**Q4. Does the order of elements matter in counting duplicates?**<br \/>\nThe order of elements does not matter when counting duplicates using the hashing approach. The hash table stores unique elements, and the duplicates are identified irrespective of their position in the linked list.<\/p>\n<p>**Q5. What if the linked list is a circular linked list?**<br \/>\nFor a circular linked list, you can use the same hashing approach to count duplicates. The traversal will continue until the loop is completed, and duplicates will be identified and processed accordingly.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article aims to aid you in understanding how to find duplicate in linked list. Familiarity with linked lists can be advantageous for succeeding in IT interviews, as a solid understanding of these data structures is often sought after during coding assessments. Without further ado, let&#8217;s delve into our topic of finding duplicates in a [&hellip;]<\/p>\n","protected":false},"author":52,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[125],"tags":[],"class_list":["post-3918","post","type-post","status-publish","format-standard","hentry","category-linked-list"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.8 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Linked List | Count duplicates in a Linked List | Prepbytes<\/title>\n<meta name=\"description\" content=\"Learn the most efficient way to find duplicates in a given linked list. This article explains the most efficient approach to find duplicates in a given linked list.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/prepbytes.com\/blog\/count-duplicates-in-a-linked-list\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Linked List | Count duplicates in a Linked List | Prepbytes\" \/>\n<meta property=\"og:description\" content=\"Learn the most efficient way to find duplicates in a given linked list. This article explains the most efficient approach to find duplicates in a given linked list.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/prepbytes.com\/blog\/count-duplicates-in-a-linked-list\/\" \/>\n<meta property=\"og:site_name\" content=\"PrepBytes Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prepbytes0211\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-08-17T13:55:19+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-07-24T07:37:45+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645617231372-count%20duplicates%20in%20linked%20list-05-05%20%281%29.png\" \/>\n<meta name=\"author\" content=\"Prepbytes\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Prepbytes\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/prepbytes.com\/blog\/count-duplicates-in-a-linked-list\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/count-duplicates-in-a-linked-list\/\"},\"author\":{\"name\":\"Prepbytes\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e\"},\"headline\":\"Count duplicates in a Linked List\",\"datePublished\":\"2021-08-17T13:55:19+00:00\",\"dateModified\":\"2023-07-24T07:37:45+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/count-duplicates-in-a-linked-list\/\"},\"wordCount\":1151,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/43.205.93.38\/#organization\"},\"image\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/count-duplicates-in-a-linked-list\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645617231372-count%20duplicates%20in%20linked%20list-05-05%20%281%29.png\",\"articleSection\":[\"Linked list articles\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/prepbytes.com\/blog\/count-duplicates-in-a-linked-list\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/prepbytes.com\/blog\/count-duplicates-in-a-linked-list\/\",\"url\":\"https:\/\/prepbytes.com\/blog\/count-duplicates-in-a-linked-list\/\",\"name\":\"Linked List | Count duplicates in a Linked List | Prepbytes\",\"isPartOf\":{\"@id\":\"http:\/\/43.205.93.38\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/count-duplicates-in-a-linked-list\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/count-duplicates-in-a-linked-list\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645617231372-count%20duplicates%20in%20linked%20list-05-05%20%281%29.png\",\"datePublished\":\"2021-08-17T13:55:19+00:00\",\"dateModified\":\"2023-07-24T07:37:45+00:00\",\"description\":\"Learn the most efficient way to find duplicates in a given linked list. This article explains the most efficient approach to find duplicates in a given linked list.\",\"breadcrumb\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/count-duplicates-in-a-linked-list\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/prepbytes.com\/blog\/count-duplicates-in-a-linked-list\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/prepbytes.com\/blog\/count-duplicates-in-a-linked-list\/#primaryimage\",\"url\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645617231372-count%20duplicates%20in%20linked%20list-05-05%20%281%29.png\",\"contentUrl\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645617231372-count%20duplicates%20in%20linked%20list-05-05%20%281%29.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/prepbytes.com\/blog\/count-duplicates-in-a-linked-list\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/43.205.93.38\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linked list articles\",\"item\":\"https:\/\/prepbytes.com\/blog\/category\/linked-list\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Count duplicates in a Linked List\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/43.205.93.38\/#website\",\"url\":\"http:\/\/43.205.93.38\/\",\"name\":\"PrepBytes Blog\",\"description\":\"ONE-STOP RESOURCE FOR EVERYTHING RELATED TO CODING\",\"publisher\":{\"@id\":\"http:\/\/43.205.93.38\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/43.205.93.38\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"http:\/\/43.205.93.38\/#organization\",\"name\":\"Prepbytes\",\"url\":\"http:\/\/43.205.93.38\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp\",\"contentUrl\":\"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp\",\"width\":160,\"height\":160,\"caption\":\"Prepbytes\"},\"image\":{\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/prepbytes0211\/\",\"https:\/\/www.instagram.com\/prepbytes\/\",\"https:\/\/www.linkedin.com\/company\/prepbytes\/\",\"https:\/\/www.youtube.com\/channel\/UC0xGnHDrjUM1pDEK2Ka5imA\"]},{\"@type\":\"Person\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e\",\"name\":\"Prepbytes\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g\",\"caption\":\"Prepbytes\"},\"url\":\"https:\/\/prepbytes.com\/blog\/author\/gourav-jaincollegedekho-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Linked List | Count duplicates in a Linked List | Prepbytes","description":"Learn the most efficient way to find duplicates in a given linked list. This article explains the most efficient approach to find duplicates in a given linked list.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/prepbytes.com\/blog\/count-duplicates-in-a-linked-list\/","og_locale":"en_US","og_type":"article","og_title":"Linked List | Count duplicates in a Linked List | Prepbytes","og_description":"Learn the most efficient way to find duplicates in a given linked list. This article explains the most efficient approach to find duplicates in a given linked list.","og_url":"https:\/\/prepbytes.com\/blog\/count-duplicates-in-a-linked-list\/","og_site_name":"PrepBytes Blog","article_publisher":"https:\/\/www.facebook.com\/prepbytes0211\/","article_published_time":"2021-08-17T13:55:19+00:00","article_modified_time":"2023-07-24T07:37:45+00:00","og_image":[{"url":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645617231372-count%20duplicates%20in%20linked%20list-05-05%20%281%29.png","type":"","width":"","height":""}],"author":"Prepbytes","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Prepbytes","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/prepbytes.com\/blog\/count-duplicates-in-a-linked-list\/#article","isPartOf":{"@id":"https:\/\/prepbytes.com\/blog\/count-duplicates-in-a-linked-list\/"},"author":{"name":"Prepbytes","@id":"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e"},"headline":"Count duplicates in a Linked List","datePublished":"2021-08-17T13:55:19+00:00","dateModified":"2023-07-24T07:37:45+00:00","mainEntityOfPage":{"@id":"https:\/\/prepbytes.com\/blog\/count-duplicates-in-a-linked-list\/"},"wordCount":1151,"commentCount":0,"publisher":{"@id":"http:\/\/43.205.93.38\/#organization"},"image":{"@id":"https:\/\/prepbytes.com\/blog\/count-duplicates-in-a-linked-list\/#primaryimage"},"thumbnailUrl":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645617231372-count%20duplicates%20in%20linked%20list-05-05%20%281%29.png","articleSection":["Linked list articles"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/prepbytes.com\/blog\/count-duplicates-in-a-linked-list\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/prepbytes.com\/blog\/count-duplicates-in-a-linked-list\/","url":"https:\/\/prepbytes.com\/blog\/count-duplicates-in-a-linked-list\/","name":"Linked List | Count duplicates in a Linked List | Prepbytes","isPartOf":{"@id":"http:\/\/43.205.93.38\/#website"},"primaryImageOfPage":{"@id":"https:\/\/prepbytes.com\/blog\/count-duplicates-in-a-linked-list\/#primaryimage"},"image":{"@id":"https:\/\/prepbytes.com\/blog\/count-duplicates-in-a-linked-list\/#primaryimage"},"thumbnailUrl":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645617231372-count%20duplicates%20in%20linked%20list-05-05%20%281%29.png","datePublished":"2021-08-17T13:55:19+00:00","dateModified":"2023-07-24T07:37:45+00:00","description":"Learn the most efficient way to find duplicates in a given linked list. This article explains the most efficient approach to find duplicates in a given linked list.","breadcrumb":{"@id":"https:\/\/prepbytes.com\/blog\/count-duplicates-in-a-linked-list\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/prepbytes.com\/blog\/count-duplicates-in-a-linked-list\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/prepbytes.com\/blog\/count-duplicates-in-a-linked-list\/#primaryimage","url":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645617231372-count%20duplicates%20in%20linked%20list-05-05%20%281%29.png","contentUrl":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645617231372-count%20duplicates%20in%20linked%20list-05-05%20%281%29.png"},{"@type":"BreadcrumbList","@id":"https:\/\/prepbytes.com\/blog\/count-duplicates-in-a-linked-list\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/43.205.93.38\/"},{"@type":"ListItem","position":2,"name":"Linked list articles","item":"https:\/\/prepbytes.com\/blog\/category\/linked-list\/"},{"@type":"ListItem","position":3,"name":"Count duplicates in a Linked List"}]},{"@type":"WebSite","@id":"http:\/\/43.205.93.38\/#website","url":"http:\/\/43.205.93.38\/","name":"PrepBytes Blog","description":"ONE-STOP RESOURCE FOR EVERYTHING RELATED TO CODING","publisher":{"@id":"http:\/\/43.205.93.38\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/43.205.93.38\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"http:\/\/43.205.93.38\/#organization","name":"Prepbytes","url":"http:\/\/43.205.93.38\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/","url":"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp","contentUrl":"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp","width":160,"height":160,"caption":"Prepbytes"},"image":{"@id":"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/prepbytes0211\/","https:\/\/www.instagram.com\/prepbytes\/","https:\/\/www.linkedin.com\/company\/prepbytes\/","https:\/\/www.youtube.com\/channel\/UC0xGnHDrjUM1pDEK2Ka5imA"]},{"@type":"Person","@id":"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e","name":"Prepbytes","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/43.205.93.38\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g","caption":"Prepbytes"},"url":"https:\/\/prepbytes.com\/blog\/author\/gourav-jaincollegedekho-com\/"}]}},"_links":{"self":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts\/3918","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/users\/52"}],"replies":[{"embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/comments?post=3918"}],"version-history":[{"count":9,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts\/3918\/revisions"}],"predecessor-version":[{"id":17315,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts\/3918\/revisions\/17315"}],"wp:attachment":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/media?parent=3918"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/categories?post=3918"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/tags?post=3918"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}