Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Append_Arrays
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<int> input = Console.ReadLine().Split('|').Select(int.Parse).ToList();
- for (int i = input.Count - 1; i >= 0; i--)
- {
- if (input[i] == null)
- {
- input.RemoveAt(i); // O(n)
- }
- }
- List <int> newList= new List<int>();
- for (int i = input.Count - 1; i >= 0; i--)
- {
- newList = input[i].ToList();
- foreach (var item in newList)
- {
- input.Add(item);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement