Skip to content

1214: Duplication Link

题目

题目描述

Given a linked list, remove the duplicate elements so that no neighboring elements are the same.
There are three types of elements:
0: int
1: char (lower and upper case character) 2: string (const char *)
Please use Class Template to implement the LinkedNode class. Also, your code are required to avoid memory lead. (TAs will check your code, so solutions without class template cannot get full score) Tip: to compare the different types, you may need Overloaded Functions. or Template Functions. If you have forgotten this knowledge, please refer to your programming textbook.

Permissible libraries:
iostream
cstdio
cstring
cmath

输入格式

Line 1: two numbers $k$ and $n$

Line 2: $n$ elements of type $k$

输出格式

Line 1: elements of the processed linked list, separated by space.

样例输入

Input Sample 1

0 5

1 2 2 4 4

Input Sample 2

2 6

cat dog dog dog fish fish

样例输出

Output Sample 1

1 2 4

Output Sample 2

cat dog fish

数据范围

k = 0, 1, 2​

1 <= n <= 100000​

1 <= int elements <= 100000​

1 <= length of string <= 10

Oops! 本题目还没有解答!

助教老师们编题的速度,已经超过了解题的速度!

OJ翻了一新,但本解答集还大多用的是2017-2019级,甚至更早的同学们贡献的答案。

如果你已经AC了,可以的话,请您参考添加页面,与大家一起分享你的题解!