using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp19
{
public class Intnode
{
private int info;
private Intnode next;
public Intnode(int info)
{
this.info = info;
}
public Intnode(int info, Intnode next)
{
this.info = info;
this.next = next;
}
public int Getinfo()
{
return info;
}
public Intnode Getnext()
{
return next;
}
public override string ToString()
{
return info.ToString();
}
}
public class NodeToolsRecursive
{
public static void PrintChain(Intnode node)
{
if (node == null)
{
Console.WriteLine("null");
return;
}
Console.Write(node.ToString() + " -> ");
PrintChain(node.Getnext());
}
public static int MaxInChain(Intnode node)
{
if (node == null)
return int.MinValue;
return Math.Max(node.Getinfo(), MaxInChain(node.Getnext()));
}
}
public class Program
{
public static Intnode MinMax(Intnode node)
{
int min = int.MinValue;
int max = int.MaxValue;
while (node != null)
{
max = Math.Max(max, node.Getinfo());
min = Math.Min(min, node.Getinfo());
node = node.Getnext();
}
return new Intnode(min, new Intnode(max));
}
public static Intnode Bruh(int[] a)
{
Intnode answer = null;
for (int i = a.Length - 1; i >= 0; i--)
answer = new Intnode(a[i], answer);
return answer;
}
public static void Main(string[] args)
{
int[] arr = { -1, -65, -3, -234, -23465, -14, -67 };
Intnode bruh = Bruh(arr);
int man = NodeToolsRecursive.MaxInChain(bruh);
Console.WriteLine(man);
}
}
}