回复: 9
跳转到指定楼层
上一主题 下一主题
收起左侧

intuit oa

全局:

2020(7-9月) 码农类General 硕士 实习@intuit - 网上海投 - 在线笔试  | | Other | 应届毕业生

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

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

x
timeline:8.24 在领英看到intuit recruiter发的链接,
您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Popular Interview Questions from Top Companies
quot;表示,而不是空格
3)每行间隔的数量必须相同

评分

参与人数 1大米 +2 收起 理由
ivyxue + 2 谢谢分享!

查看全部评分


上一篇:【达摩院实习面经】虽然跪在终面,但知识点不少【求米】
下一篇:最新吴博在线测试
🔗
AssassinGG 2020-8-31 16:27:07 | 只看该作者
全局:
请问楼主是联系recruiter然后给你发的链接么?
回复

使用道具 举报

🔗
DAL185 2020-8-31 19:57:16 | 只看该作者
全局:
楼主方便发下recruiter的名字吗?我在官网上好像没看到new grad职位
回复

使用道具 举报

🔗
 楼主| adamoni 2020-9-1 01:30:30 来自APP | 只看该作者
全局:
DAL185 发表于 2020-08-31 04:57:16
楼主方便发下recruiter的名字吗?我在官网上好像没看到new grad职位
我没有联系recruiter,是填写了一个google form, 今天翻linkedin已经找不到这个form了,抱歉呀😭
回复

使用道具 举报

🔗
Smilenceyu 2020-9-1 12:33:44 | 只看该作者
全局:
请教lz是这个题么?所以就是每一行left justify,每个词之间用-。每行间隔相同是什么意思?
  1. # We are building a word processor and we would like to implement a "word-wrap" functionality.

  2. # Given a maximum number of characters in a line followed by a list of words, return a collection of strings where each string element represents a line that contains as many words as possible, with the words in each line being concatenated with a single '-' (representing a space, but easier to see for testing). The length of each string must not exceed the maximum character length per line.
  3. # Your function should take in the maximum characters per line and return a data structure representing all lines in the indicated max length.
  4. # Note: built-in functions like Python textwrap module should not be used as solutions to this problem.

  5. # Examples:

  6. # words1 = [ "The", "day", "began", "as", "still", "as", "the", "night", "abruptly", "lighted", "with", "brilliant", "flame" ]
  7. # wrapLines(words1, 13) ... "wrap words1 to line length 13" =>
  8. #   [ "The-day-began", "as-still-as", "the-night", "abruptly", "lighted-with", "brilliant", "flame" ]

  9. # wrapLines(words1, 20) ... "wrap words1 to line length 20" =>
  10. #   [ "The-day-began-as", "still-as-the-night", "abruptly-lighted", "with-brilliant-flame" ]

  11. # words2 = [ "Hello" ]
  12. # wrapLines(words2, 5) ... "wrap words2 to line length 5" =>
  13. #   [ "Hello" ]

  14. # words3 = [ "Hello", "world" ]
  15. # wrapLines(words3, 5) ... "wrap words3 to line length 5" =>
  16. #   [ "Hello",  "world" ]

  17. # n = number of words / total characters
复制代码




回复

使用道具 举报

🔗
 楼主| adamoni 2020-9-1 12:35:35 | 只看该作者
全局:
您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Popular Interview Questions from Top Companies
回复

使用道具 举报

🔗
Smilenceyu 2020-9-1 12:36:51 | 只看该作者
全局:
adamoni 发表于 2020-9-1 12:35
挺像的,但不完全一样, 词之间的"-"不一定只有一个。
间隔相同指的是,词之间的“-”数量必须相同。

这样啊 那怎么决定这个“-”的数量呢,完全没思路,lz是怎么做的
回复

使用道具 举报

🔗
 楼主| adamoni 2020-9-1 12:57:21 | 只看该作者
全局:
Smilenceyu 发表于 2020-9-1 12:36
这样啊 那怎么决定这个“-”的数量呢,完全没思路,lz是怎么做的

你可以看一下力扣那题的discussion
回复

使用道具 举报

🔗
Smilenceyu 2020-9-2 02:18:32 | 只看该作者
全局:
根据lz的描述,应该比text justification简单一些,因为不需要跟右边margin对齐。
写了一下ruby的版本:

  1. def full_justify_variant(input, max_width)
  2.   words = []
  3.   input.each do |line|
  4.     words.push(*line.split(' '))
  5.   end

  6.   lines = []
  7.   line = []
  8.   letter_count = 0
  9.   (0...words.length).each do |word_idx|
  10.     word = words[word_idx]
  11.     if line.length + letter_count + word.length > max_width
  12.       lines << justify_line(line, letter_count, max_width)
  13.       line = []
  14.       letter_count = 0
  15.     end
  16.     line << word
  17.     letter_count += word.length
  18.   end
  19.   lines << justify_line(line, letter_count, max_width)
  20.   lines
  21. end

  22. def justify_line(line, letter_count, max_width)
  23.   total_spaces = max_width - letter_count

  24.   if line.length == 1
  25.     line.join + ' ' * total_spaces
  26.   else
  27.     space_count = (total_spaces / (line.length - 1)).to_i
  28.     remaining_spaces = total_spaces % (line.length - 1)
  29.     line.join(' ' * space_count) + ' ' * remaining_spaces
  30.   end
  31.   end

  32. input = [
  33.   'It was the best',
  34.   'of times it was',
  35.   'the worst of times'
  36. ]
  37. max_width = 12
  38. output = full_justify_variant(input, max_width)
  39. output.each { |line| puts line }
复制代码


回复

使用道具 举报

全局:
楼主最后有结果了吗?
回复

使用道具 举报

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

本版积分规则

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