> For the complete documentation index, see [llms.txt](https://dailyjournal.gitbook.io/solutions/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dailyjournal.gitbook.io/solutions/hackerearth-solutions/practice/data-structure/linked-list.md).

# Linked List

## Reversed Linked List

{% embed url="<https://www.hackerearth.com/practice/data-structures/linked-list/singly-linked-list/practice-problems/algorithm/reversed-linked-list-01b722df/>" %}

```csharp
using System;
using System.Collections;
					
public class Program {
    public static void Main(string[] args) {
        int n = int.Parse(Console.ReadLine());
	var input = Console.ReadLine().Split(" ");
	Stack evenStack = new Stack();
	for(int i = 0; i < n; i++) {
            var num = Convert.ToInt32(input[i]);
            if(num % 2 == 0) 
                evenStack.Push(num);
            else {
                while(evenStack.Count > 0) {
		    Console.Write(evenStack.Pop() + " ");
	        }
                Console.Write(num + " ");
            }
        }
	while(evenStack.Count > 0) {
            Console.Write(evenStack.Pop() + " ");
        }
    }
}
```
