回复: 2
收起左侧

小众公司woven 的家庭作业

匿名用户-BIGKT  2023-10-24 13:28:08
本楼:   👍  0
0%
0%
0   👎

2023(10-12月) 码农类General 硕士 全职@woven-planet - 网上海投 - 在线笔试  | 😐 Neutral 😐 Average | Other | 在职跳槽

注册一亩三分地论坛,查看更多干货!

您需要 登录 才可以下载或查看附件。没有帐号?注册账号

x
在海投过简历后, HR发来作业。

要求如下:

The application 'buggy.cxx' performs the following functions:
a) It reads a list of ASCII words from STDIN, a word per input line, terminated by
the word 'end'.
b) It removes the duplicates, sorts the words alphabetically, and prints them with
the number of how many times each word was encountered.
c) Then it repeatedly asks the user to enter a word and tries to look it up in the
word list which was entered initially. It terminates when it encounters EOF.
The project has a number of bugs and design deficiencies. Please, fix all problems
that you can find and make all the improvements you deem necessary so that the
result satisfies your personal standards (what would you expect a well maintained
C++ project to look like? File structure? Class structure / encapsulation? Testing
tools? Build tools?).

code如下:

#include <thread>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cstring>

struct Word
{
  char * data;
  int count;

  Word ( char * data_ ) :
    data( ::str
您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限查看其他获取积分的方式
}
    else
      std::printf( "'%s' was NOT found in the initial word list\n", w->data );
  }
}

int main ()
{
  try
  {
    readInputWords();

    // Sort the words alphabetically
    std::sort( s_wordsArray.begin(), s_wordsArray.end() );

    // Print the word list
    std::printf( "\n=== Word list:\n" );
    for ( auto p : s_wordsArray )
      std::printf( "%s %d\n", p->data, p->count );

    lookupWords();

    printf( "\n=== Total words found: %d\n", s_totalFound );
  }
  catch (std::exception & e)
  {
    std::printf( "error %s\n", e.what() );
  }

  return 0;
}

本人C++ 不是很熟, 忘大家给点意见

评分

参与人数 1大米 +25 收起 理由
清道神君 + 25 欢迎分享你知道的情况,会给更多大米奖励!

查看全部评分


上一篇:字节tiktok sre一轮挂经
下一篇:Oracle 店面面经
cubic27 2023-10-24 14:06:31 | 显示全部楼层
本楼:   👍  0
0%
0%
0   👎
全局:   17
100%
0%
0
我很好奇chatgpt和gpt4能不能答得不错
回复

使用道具 举报

矿大男神 2023-10-24 15:10:53 | 显示全部楼层
本楼:   👍  0
0%
0%
0   👎
全局:   4071
93%
7%
288
这公司可不小众,做自动驾驶的头部公司了,很强。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

>
快速回复 返回顶部 返回列表