文章

21

粉丝

0

获赞

0

访问

650

头像
2025 年 5 月第 1 次 408 月考试卷 - 第41题回答
数据结构
发布于2025年8月6日 23:21
阅读数 40

1):利用滑动窗口。左边界指向第一次遍历的元素,右边界检查自己所指元素与左边界是否相同,若相同则让count++,不同则检查此时count是否为0,若是则打印否则不打印,然后左边界到右边界处,count归0并重复执行上步。

2): void Print_Single(int num[],int len){

            int slow=0;

           int fast=0;

           int count=0;

           while(fast<len){

            if(num[fast]==num[slow]){

                fast++;

               count++;

               continue;

        }

         if(count!=0){

            count=0;

            slow=fast;

           continue;

}

   else{

      print(num[slow]);

   ...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发