Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6736265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:06:34+00:00 2026-05-26T11:06:34+00:00

this is an interview question and I was trying to solve it. I completely

  • 0

this is an interview question and I was trying to solve it.
I completely solved and I realized that I missed one test case.

The question is , how would you delete a second occurrence of a node in a linklist.
FOr example:
1->2->9->5->2 and I enter 2.
so the out put should be 1->9>5->2

I did solve using two pointers first and second which will keep on swaping based on the findings.
And I am always storing the previous pointer. for example in above example I am storing at 1 and 5. so that I could always delete the next one.

But what if the linklist becomes like this:
2->7->9->2
and the out out has to be 7->9->2.

Do let me know, if you guys have any questions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T11:06:35+00:00Added an answer on May 26, 2026 at 11:06 am
    • Iterate the list left to right, assuming single-linked list.
    • If the next node is the one you are looking for, point at it with a temp pointer.
    • Let the current node’s next pointer point at next->next.
    • Delete the node the temp pointer points at.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've encountered this interview question and would like some help in trying to understand
Just finished reading this blog post: http://www.skorks.com/2010/03/an-interview-question-that-prints-out-its-own-source-code-in-ruby/ In it, the author argues the case
This was the question asked in interview. Can we call one constructor from another
Here is an interview question that I saw on some forum. I've been trying
Note: This was an interview question and may not have an actual use case
I am trying to code a trival interview question of reversing a string. This
I am trying to write a simple program for this interview question: Write a
This is an interview question. I have no idea how to solve it. could
This is a question Im trying to figure out for a job pre-interview questioniar.
This is an interview question: Given a string, find all its permutations that are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.